After doing some research I have found out that I cannot simply do subtotals after each row group in Pandas (which is default feature of Excel's pivot table - below an example)
Pandas pivot does it only as total for all groups, not for each group, as after every rectangle like below
My code :
ramka = pd.DataFrame(frame)
ramka.columns = ['PPE ID', 'Volume Actual', 'Month', 'Year', 'Volume Forecast' , 'Volume difference' ]
ramka['Financial Year']=ramka.apply(f,axis=1)
pivot=pd.pivot_table(ramka,index=['Financial Year','Year','Month'], values=['Volume Actual', 'Volume Forecast' , 'Volume difference'], aggfunc=np.sum, margins=True)
Any ideas? Thank you in advance for any help.