I want to plot histograms for timedelta64 (example: Timedelta('0 days 00:00:44.749500'
)
But in both cases, ploty.histogram() does not recognize the correct time but rather displays values (e.g., 50T 60T (See image)).
How do I have to convert the datetime/timedelta that plotly .histogram() recognizes the correct timeaxis? Thanks
fig = px.histogram(x=df_TT_redux["T_delta"],color=df_TT_redux["event_source"],log_y=True)
EDIT: THanks to LittlePanic404 converting to ISO Format gives some interesting results. I guess I have to tweak that still a bit.
using
import isodate
df_TT_redux["T_delta3"]=[isodate.duration_isoformat(x) for x in df_TT_redux["T_delta"]]
fig = px.histogram(x=df_TT_redux["T_delta3"],color=df_TT_redux["event_source"],color_discrete_map=color_discrete_map,log_y=False,log_x=False,nbins=100)
However, another way of solving this could be this:
df_TT_redux["T_delta2"]=df_TT_redux["T_delta"]/pd.Timedelta("1 hour")
or
.../pd.Timedelta("1 minute")
. Depending on your case