I have a timeseries in Pandas where the dates are at the end of the month:
import pandas as pd
s = pd.Series({
'2018-04-30': 0,
'2018-05-31': 1,
'2018-06-30': 0,
'2018-07-31': 1,
'2018-08-31': 0,
'2018-09-30': 1,
})
s.index = pd.to_datetime(s.index)
When I plot this with matplotlib I get the result I'd expect, with points at the end-of-month and the line starting just before May 2018:
import matplotlib.pyplot as plt
plt.plot(s)
But Pandas' native plot function plots the points at the start of the month:
s.plot()
I thought perhaps this was just Pandas labelling '30 April' as 'April', but that doesn't seem to be the case:
s2 = pd.Series([0.2, 0.7], index=pd.date_range('2018-05-01', '2018-05-02'))
s.plot()
s2.plot()
Is this a bug in Pandas or am I doing something wrong here?