I am new to Plotly and Python. I am trying to use plotly.express timeline to plot process during event log. Here is a simple code to show what I wanted to achieve:
import plotly.express as px
import pandas as pd
df = pd.DataFrame([
dict(Task=βWk1β, Start=β2.1β, End=β5.5β, Category=βGroup1β),
dict(Task=βWk2β, Start=β5.5β, End=β10.0β, Category=βGroup1β),
dict(Task=βWk3β, Start=β22.3β, End=β28.9β, Category=βGroup1β),
dict(Task=βWk4β, Start=β12.6β, End=β14.0β, Category=βGroup2β),
dict(Task=βWk5β, Start=β14.0β, End=β18.3β, Category=βGroup2β),
dict(Task=βWk6β, Start=β18.3β, End=β20.8β, Category=βGroup2β)
])
df[βStartβ] = pd.to_datetime(df[βStartβ], unit=βsβ)
df[βEndβ] = pd.to_datetime(df[βEndβ], unit=βsβ)
fig = px.timeline(df, x_start=βStartβ, x_end=βEndβ, y=βCategoryβ, color=βTaskβ, title=βunit=βsββ)
fig.show()
Because my process durations are in microseconds, so the βStartβ and βEndβ unit should actually be βusβ. However, if I change the unit in pd.to_datetime() to βusβ, I only get a total blank drawing.
I thought the accuracy of the datetime is datetime64[ns], which I assume is up to the nanosecond. Please help.
Below is my plot results: