Given the dataframe below, I want to filter records that shares the same q2, id_q, check_id and keep only the ones with the highest value.
input dataframe:
| q1 | q2 | id_q | check_id | value |
|---|---|---|---|---|
| sdfsdf | dfsdfsdf | 10 | 10 | 90 |
| hdfhhd | dfsdfsdf | 10 | 10 | 80 |
There are 2 q2 with same id_q, check_id but with different values: 90,80.
I want to return for the same q2, id_q, check_id the line with the highest value. For example above the output is:
So I want to drop duplicates regarding to: check_id and id_q and keep the one with the highest value of valuecolumn
Desired Output:
| q1 | q2 | id_q | check_id | value |
|---|---|---|---|---|
| sdfsdf | dfsdfsdf | 10 | 10 | 90 |