Function turns Values to NaN unwanted

Advertisements I wrote a function to fill NaN with Values, but instead this function first fills the NaN with values and then deletes every value that was in the list before I did the function def preprocessing(df): median_male_3= df[(df["Sex"]=="male") & (df["Pclass"] ==3 )]["Age"].median() median_male_2= df[(df["Sex"]=="male") & (df["Pclass"] ==2 )]["Age"].median() median_male_1= df[(df["Sex"]=="male") & (df["Pclass"] ==1 )]["Age"].median()… Read More Function turns Values to NaN unwanted

How to get Maximum points scored by which player in each year?

Advertisements I have a Data set like this – Name Point Year Player1 498.0 2010 Player2 454.0 2010 Player1 396.0 2011 Player3 214.0 2011 player2 163.0 2011 Now I want to see which Player scored the maximum point in each year. I tried this – Maximum_score = df.groupby([‘Year’])[‘Point’].max() and got the result – Year 2010… Read More How to get Maximum points scored by which player in each year?