TypeError after trying to plot dataframe with mpf.plot

181 views Asked by At

I have a panda dataframe with the following columns: enter image description here

Now I would like to plot out a chart with mpf.plot. But I am getting the following error: enter image description here

How can I avoid the above TypeError Message? I did set the df index with the following command:

dfnew_plot = dfnew_plot.set_index('Date')
1

There are 1 answers

2
Ollie in PGH On BEST ANSWER

Your index isn't the correct dtype. It needs to be converted using:

dfnew_plot.index = pd.to_datetime(dfnew_plot.index)