Sometimes we need to combine values and de-dupe specific columns. Here's an example:
A B C
1 foo 12 California
2 foo 22 California
3 bar 8 Rhode Island
4 bar 32 Rhode Island
5 baz 15 Ohio
6 baz 26 Ohio
You might want this:
A B C
1 foo 34 California
2 bar 40 Rhode Island
3 baz 41 Ohio
Two solutions:
df.groupby(['A','C'])['B'].sum()
And ... this "returns" a DataFrame
df.groupby(['A','C'], as_index=False)['B'].sum()