python - Pandas plotting: ValueError: ordinal should be >= 1 -


i have following series, called sr.

in [1]: sr out[1]: 0     0         1     0         2     0         3     0         4     0         5     1         6     2         7     4         8     7         9     4         10    3         11    2         12    1         13    2         14    2         15    2         16    4         17    7         18    7         19    5         20    3         21    2         22    1         23    1         dtype: int64 

i plot series, rolling mean. this, use following code:

import matplotlib.pyplot plt import pandas pd  rolling = pd.rolling_mean(sr, 3, center=true) ax_delays = sr.plot(style='--', color='b') rolling.plot(color='b', ax=ax_delays, legend=0) plt.title('title') plt.ylim(ymax=10) plt.show() 

but gives me following error:

valueerror                                traceback (most recent call last)       1 rolling = pd.rolling_mean(sr, 3, center=true) ----> 2 ax_delays = sr.plot(style='--', color='b')       3 rolling.plot(color='b', ax=ax_delays, legend=0)       4 plt.title('title')       5 plt.ylim(ymax=10)  valueerror: ordinal must >= 1 

what error mean , how can fix it?

if run plt.clf() clear plot in memory , may allow plotting proceed (worked me when encountered error after interrupting plotting routine).


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -