There's probably a better way than this:
In [44]: vals = df.groupby(lambda x: (x.year, x.month)).sum()
In [45]: vals
Out[45]:
(2000, 1) -0.235044
(2000, 2) -1.196815
(2000, 3) -0.370850
(2000, 4) 0.719915
(2000, 5) -1.228286
(2000, 6) -0.192108
(2000, 7) -0.337032
(2000, 8) -0.174219
(2000, 9) 0.605742
(2000, 10) 1.061558
(2000, 11) -0.683674
(2000, 12) -0.813779
(2001, 1) 2.103178
(2001, 2) -1.099845
(2001, 3) 0.366811
...
(2004, 10) -0.905740
(2004, 11) -0.143628
(2004, 12) 2.166758
(2005, 1) 0.944993
(2005, 2) -0.741785
(2005, 3) 1.531754
(2005, 4) -1.106024
(2005, 5) -1.925078
(2005, 6) 0.400930
(2005, 7) 0.321962
(2005, 8) -0.851656
(2005, 9) 0.371305
(2005, 10) -0.868836
(2005, 11) -0.932977
(2005, 12) -0.530207
Length: 72, dtype: float64
Now change the index on vals
to a MultiIndex
In [46]: vals.index = pd.MultiIndex.from_tuples(vals.index)
In [47]: vals.head()
Out[47]:
2000 1 -0.235044
2 -1.196815
3 -0.370850
4 0.719915
5 -1.228286
dtype: float64
Then unstack and plot:
In [48]: vals.unstack(0).plot()
Out[48]: <matplotlib.axes.AxesSubplot at 0x1171a2dd0>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…