Using the built in "tips" dataframe in plotly express, I first create a datetime column.
import plotly.express as pximport pandas as pdfrom datetime import datetimedf_tips = px.data.tips()datelist = pd.date_range(datetime.today(), periods=df_tips.shape[0]).tolist()df_tips['date'] = datelist
Using a column of datetimes as the x-axis gives the error:
px.scatter(df_tips,x='date',y='tip',trendline='ols') ...TypeError: cannot astype a datetimelike from [datetime64[ns]] to [int32]
Using any other column does not. Is there a good way to do this?