Skip to content Skip to sidebar Skip to footer

Python Plotly (px) Animation Frame Date Is In Wrong Order

With plotly express I've built a bar chart similar to as shown on their website. As px.bar did not allow me to run the animation frame on datetime64[ns] I transformed the datetime

Solution 1:

Sorting my df by the date solved the issue.

  covid_df['date'] = pd.to_datetime(covid_df['date'])
  covid_df = covid_df.sort_values('date', ascending=True)
  covid_df['date'] = covid_df['date'].dt.strftime('%m-%d-%Y')

Post a Comment for "Python Plotly (px) Animation Frame Date Is In Wrong Order"