I have a pandas dataframe of numeric data, e.g.
A | B | C | |
---|---|---|---|
1 | a1 | b1 | 1 |
2 | a2 | b2 | 2 |
3 | a3 | b3 | 1 |
4 | a4 | b4 | 2 |
where a_n and b_n are just any numeric values.
Notice in column C there are 2 entries of 1 and 2 entries of 2. How do I deal with these duplicates such that I sum rows that have duplicate entries in C? i.e. the result is:
A | B | C | |
---|---|---|---|
1 | a1+a3 | b1+b3 | 1 |
2 | a2+a4 | b2+b4 | 2 |