I have this dataframe and I want to find out who secured maximum points in each city.
import pandas as pd
df = pd.DataFrame({"City":["Delhi","Delhi","Mumbai","Mumbai","Lahore","Lahore"],
"Points":[90.1,90.3,94.1,95,89,90.5],
"Gender":["Male","Female","Female","Male","Female","Male"]})
So far I have tried this, but this is giving me the toppers of both gender[male and female] in each city,
df.groupby(by=["City","Gender"],sort=False)["Points"].max()
I want a single candidate[male or female] who scored maximum points in each city.