I have a dataframe in Pandas which has data like the below:
charge id | charge | payment | adjustment | type |
---|---|---|---|---|
123 | $45 | $30 | 0 | P |
123 | $45 | 0 | $10 | A |
124 | $50 | $20 | 0 | P |
I then use the pivot table to aggregate the data to produce sums / counts of various fields. However summing the charge is incorrect as the same charge can be in the data multiple times. Is it possible to sum the charge once based on the charge id
field? So in this example charge id
123
would only be included once in the total.