I think I have the same question as the one asked here How to do arithmetics on values of a column according to unique pair values of two other column but for Python.
I have three columns in my dataframe.
Id1 Id2 Points
what i want to finally get is a dataframe that contains only the those rows that have unique Id1 and Id2 pairs. In case there is redundancy in the original dataframe, I would like to have the value of 'Points' in my new dataframe as the sum of values from the original dataframe that correspond to that unique (Id1, Id2) pair.
Within Pandas, I have looked at 'groupby' (followed by a '.sum()') and 'sort_values' but I could not think of a way to pull off what I wanted to.
Here is what I want to do-
Originial
Id1 Id2 Points
1 3 18
2 6 15
1 3 17
1 4 11
1 1 15
New
Id1 Id2 Points
1 1 15
1 3 35
1 4 11
2 6 15
Please excuse the poor formatting