The question is below. I used the code below the question. There has to be another way to code for what the question is asking other than the way I did.
Use groupby to group the rating variable by the player's position. Which position has the lowest mean rating? Remember to chain .sort_values(ascending=True) to sort the resulting data on their values and not alphabetically by position name.
df.groupby('position')['rating'].mean().reset_index().sort_values(by='rating',ascending=True)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here