I have the following Pandas DataSeries:
Date
2006-01 16.050000
2006-02 14.052632
2006-03 15.565217
...
2019-11 31.650000
2019-12 20.350000
Freq: M, Name: Value, Length: 168, dtype: float64
print(type(data_month2))
<class 'pandas.core.series.Series'>
print(type(data_month2.index))
<class 'pandas.core.indexes.period.PeriodIndex'>
I want to display the series values in Matplotlib, I have tried this:
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.axes()
ax.plot(data_month2.index, data_month2);
But I get:
TypeError: float() argument must be a string or a number, not 'Period'
data_month2.plot.line(); plt.show()