Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
BUG: plotting daily data with two-day gaps #1668
you should be able to copy and paste this in a ipython --pylab session:
import pandas index = pandas.date_range(start='2001-1-1', end='2001-1-10', freq='D') data = index.day ts = pandas.TimeSeries(index=index, data=data) tsWithGaps = ts[:3].append(ts[5:]) figure() tsWithGaps.plot(style='o') figure() tsWithGaps.asfreq('D').plot(style='o')
I tried this snippet with 0.8.2.dev-7c54141 (i.e. latest git version as I write). The two plots below come from an improved version of the snippet which prints the timeseries on the plot.
The first plot I get looks weird (wrong label for January 5th + double data point on the 8th)
The second plot with the explicitly resampled ts is fine:
Trying to tweak the parameters a 3-day gap looks fine and you get x axis labelling like plt.plot_date. She 2-day gaps seems always broken, although in a more subtle way than the plot above (generally the label before the gap is wrong but I don't get double data points). It looks like a timeseries with 2-day gaps is close enough to a regular index timeseries (maybe because of week-ends) and the index labelling goes wrong somewhere.