I have the foll. pandas dataframe with datetime index:
datetime VAL
2000-01-01 -283.0000
2000-01-02 -283.0000
2000-01-03 -10.6710
2000-01-04 -12.2700
2000-01-05 -10.7855
2001-01-06 -9.1480
2001-01-07 -9.5300
2001-01-08 -10.4675
2001-01-09 -10.9205
2001-01-10 -11.5715
I would like to compute cumulative values for each year and replace the VAL column by the cumulative values. E.g, It will look something like this:
datetime VAL
2000-01-01 -283.0000
2000-01-02 -283.0000 + -283.0000
2000-01-03 -10.6710 + -283.0000 + -283.0000
2000-01-04 -12.2700 + -10.6710 + -283.0000 + -283.0000
2000-01-05 -10.7855 + -12.2700 + -10.6710 + -283.0000 + -283.0000
2001-01-06 -9.1480
2001-01-07 -9.5300 + -9.5300
2001-01-08 -10.4675 + -10.4675
2001-01-09 -10.9205 + -10.9205
2001-01-10 -11.5715 + -11.5715
I haven't done the actual calculations which is why you see -283.000 + -283.000 instead of -566.0000
Not sure how to proceed with this, I could do a groupby and then?