0

I have a dataframe like this one

ddf = pd.DataFrame({
    'A': ['a', 'a', 'c', 'c'],
    'B': ['b', 'b', 'd', 'd'],
    'C': [1, 2, 3, 4]
})

ddf


    A   B   C
0   a   b   1
1   a   b   2
2   c   d   3
3   c   d   4

And i would like to have the following result by summing through column C:

    A   B   C
0   a   b   3
1   c   d   7

How to do that in pandas ?

moctarjallo
  • 1,479
  • 1
  • 16
  • 33

0 Answers0