I am trying to use plotly with streamlit.
I want to add error bars to my data.
The y axis is a date, and I have start and end date, therefore, I compute the timedelta.
Then, I use total_seconds and multiply by 1000 to get the error.
See my code:
df["date_finish"] = pd.to_datetime(df.date_finish)
df["date_start"] = pd.to_datetime(df.date_start)
df["date_delta"] = (df["date_finish"] - df["date_start"]) / 2
df["center_date"] = df["date_start"] + df["date_delta"]
df["date_error"] = df.date_delta.dt.total_seconds() * 1000
fig = px.scatter(
df,
x="my_data",
y="center_date",
color="categories",
error_x="data_error",
error_y="date_error",
)
st.plotly_chart(fig)
This is, however, not working, neither does it work to use timedelta (as it should work ideally). What am I doing wrong?
I have checked, and this is my error date values:
df.date_error.describe()
count 6.300000e+01
mean 3.099296e+06
std 2.830500e+05
min 2.801949e+06
25% 2.813138e+06
50% 3.113366e+06
75% 3.405682e+06
max 4.026567e+06