How do I take max value of a pandas dataframe column and find the corresponding value in another column?

Viewed 3480

I want to take max value of a pandas dataframe column and find the corresponding value in another column? Let's assume there are not duplicates in the maximum value, so you are always returning only one value. For example,

GPA   ID
2.3  Tina1
3.4  Bob1
3.6  Lia1
2.9  Tina2
4.0  Blake1
4.5  Conor2

Here the max GPA is 4.5, but I want to return the corresponding id for the max GPA, so I would return Conor2. I am unsure of how to do this, so help would be greatly appreciated :) Thanks!

2 Answers
Related