Open
Description
If you do a time series plot:
s = pd.Series(np.random.randn(100), index=pd.date_range('1970-01-02', periods=100, freq='T'))
fig, ax = plt.subplots()
s.plot(ax=ax)
and then want to add a line through matplotlib using the index or datetime64 values, this does not work (it plots the data at a totally wrong place outside of sight in this case):
ax.plot(s.index, s.values, color='g')
# or
ax.plot(s.index.values, s.values, color='r')
This is because PeriodConverter
cannot deal with datetime64 values (Period
/PeriodIndex
also cannot deal with them), while when plotting this through the pandas plot interface, the datetime64 values will first be converted to periods.