Scatter plot form dataframe with index on x-axis

This is kind of ugly (I think the matplotlib solution you used in your question is better, FWIW), but you can always create a temporary DataFrame with the index as a column usinng

df.reset_index()

If the index was nameless, the default name will be 'index'. Assuming this is the case, you could use

df.reset_index().plot(kind='scatter', x='index', y='columnA')

Leave a Comment

tech