I have a multi-index dataframe that shows the sum of transactions on a monthly frequency.
I am trying to get a cumsum() on yearly basis that respects my 'mapid' and 'service' multi-index. However I don't know how to derive that data
combined_df = combined_df.groupby([pd.Grouper(freq='M'), 'provider', 'mapid', 'service']).sum()cost
datetime provider mapid service
2017-08-31 Amazon 10147.0 Monitor 0.41Storage 90.51Virtual Machine 11646.32
2017-09-30 Amazon 10147.0 Monitor 0.89Storage 226.06Virtual Machine 32624.91
2017-10-31 Amazon 10147.0 Monitor 0.17Storage 261.72Virtual Machine 36934.93
2017-11-30 Amazon 10147.0 Monitor 0.35Storage 269.06Virtual Machine 30790.70
I would like to derive the follow results