Pivot table subtotals in Pandas

your pivot table table = pd.pivot_table(df, values=[‘Amount’], index=[‘Location’, ‘Employee’], columns=[‘Account’, ‘Currency’], fill_value=0, aggfunc=np.sum, dropna=True, ) print(table) Amount Account Basic Net Currency GBP USD GBP USD Location Employee Airport Test 2 0 3000 0 2000 Town Test 1 0 4000 0 3000 Test 3 5000 0 4000 0 pandas.concat pd.concat([ d.append(d.sum().rename((k, ‘Total’))) for k, d in … Read more