group by a column in pandas and calculate the sum of other column code example Example: python groupby sum single columns df.groupby(['A','C'], as_index=False)['B'].sum()