I am looking at the below csv file :
We have the question :
Display the mean of the variable gre by group of admitted/not admitted students, using the combination of groupby and mean methods.
I would write :
df['gre'].mean(df.groupby('admit'))
But the correct answer is :
df[['gre', 'admit']].groupby('admit').mean()
Why do we write before we call the groupby method both columns gre and admit ?
