pandas groupby sum keep string columns code example
Example 1: pandas groupby sum
df.groupby(['Fruit','Name'])['Number'].sum()
Example 2: python groupby sum single columns
df.groupby(['A','C'], as_index=False)['B'].sum()
df.groupby(['Fruit','Name'])['Number'].sum()
df.groupby(['A','C'], as_index=False)['B'].sum()