pandas groupby sum sort within groups code example
Example 1: pandas groupby sum
df.groupby(['Fruit','Name'])['Number'].sum()
Example 2: pandas sum group by
df.groupby(['Fiscal_Year','Billing_Group'])['CHARGE_AMT'].sum()
df.groupby(['Fruit','Name'])['Number'].sum()
df.groupby(['Fiscal_Year','Billing_Group'])['CHARGE_AMT'].sum()