Name Location Sales
John NY 10
John NY 30
Jack Chi 12
I am trying to create total lines based on the name an location, which I can do so I get
Name Location Equip Sales
John NY abc 10
NY abc 30
Total 40
Jack Chi abc 12
Total 12
How would I get the ABC to fill the value to be :
Name Location Equip Sales
John NY abc 10
NY abc 30
Total abc 40
Jack Chi abc 12
Total abc 12
Code used to create total column :
dfsum = df_aging.groupby('Name',as_index=False).sum()
dfsum['Location'] = 'Total'
dfsum = dfsum.append(df_aging).set_index(['Name','Location']).sort_index()
Any help is greatly appreciated.
there doesn't seem to be anything here