Plotly doesn't auto-set the axis type to a date format

Plotly auto-sets the axis type to a date format when the corresponding data are either ISO-formatted date strings or if they’re a date pandas column or datetime NumPy array.

This is a quote from the manual here:

I think it is not the actual behaviour, since when I pass in a df.index with dtype=PeriodIndex, which I consider as a valid pandas date format, it throws an exception about PeriodIndex is not possible to JSON Serialise.

Sure I can go like df.index = df.index.astype(str)

Then do the: fig = px.line(df, x=df.index, y=(col2), title=‘Whatever’)

But this conversion step is what should be avoided in the first place I think. Plotly should be able to read out a PeriodIndex.

Any way to make this work without conversion?

anybody using PeriodIndex here?

See https://github.com/plotly/plotly.py/issues/2764