I want to find the player with max overall rating in each position. What is the best and compact way to do it in pandas?.
Name Overall Potential Club Position
L. Messi 94 94 FC Barcelona RF
Ronaldo 94 94 Juventus ST
Neymar Jr 92 93 Paris Saint-Germain LW
De Gea 91 93 Manchester United GK
K. De Bruyne 91 92 Manchester City RCM
E. Hazard 91 91 Chelsea LF
L. Modrić 91 91 Real Madrid RCM
L. Suárez 91 91 FC Barcelona RS
Sergio Ramos 91 91 Real Madrid RCB
J. Oblak 90 93 Atlético Madrid GK
R. Lewandowski 90 90 FC Bayern München ST
T. Kroos 90 90 Real Madrid LCM
I have tried:
fifa.groupby(by = ["Position"])['Overall'].max()
followed by
fifa.loc[(fifa["Position"] == "CAM") & (fifa['Overall'] == 89),:]
But since there are so many categories in Position, it's a tedious task.