pandas dataframe sum by group and then assign code example
Example 1: python groupby sum single columns
df.groupby(['A','C'], as_index=False)['B'].sum()
Example 2: pandas sum group by
df.groupby(['Fiscal_Year','Billing_Group'])['CHARGE_AMT'].sum()