I have a dataframe with multiple attributes, some are repeating. I want to select the rows based on the max value in one column - but return the row having that value (not the max of every column). How??
Here's a sample:
df = pd.DataFrame({'Owner': ['Bob', 'Jane', 'Amy',
'Steve','Kelly'],
'Make': ['Ford', 'Ford', 'Jeep',
'Ford','Jeep'],
'Model': ['Bronco', 'Bronco', 'Wrangler',
'Model T','Wrangler'],
'Max Speed': [80, 150, 69, 45, 72],
'Customer Rating': [90, 50, 91, 75, 99]})
this gives us:
I want the row having the max(customer rating) for each Make/Model.
Like this:
Note this is NOT the same as df.groupby(['Make','Model']).max()
--> How do I do this?