I have a dataframe with two columns ID and Salary
data = {'ID':[1,2,3,4,2],'salary':[1e3,1.2e3,1e3,2e3,1.5e3]}
+----+--------+
| ID | salary |
+----+--------+
| 1 | 1000.0 |
+----+--------+
| 2 | 1200.0 |
+----+--------+
| 3 | 1000.0 |
+----+--------+
| 4 | 2000.0 |
+----+--------+
| 2 | 1500.0 |
+----+--------+
In this data frame some ID are duplicated, ID=2 in this case. I want to keep the highest salary for each duplicate ID.
+----+--------+
| ID | salary |
+----+--------+
| 1 | 1000.0 |
+----+--------+
| 2 | 1500.0 |
+----+--------+
| 3 | 1000.0 |
+----+--------+
| 4 | 2000.0 |
+----+--------+