I want to see all the means of the numerical columns, grouped by position, using
dfMockPos.groupby(['Position']).mean()
When I do this I only get 3 of the many columns
The other columns are all integers or floats, and they have no NAs.
If I do
dfMockPos['Weight'].mean()
Then I get the correct output. How can I display weight using groupby?
Thanks for any help
Advertisement
Answer
You can try using the Aggregate function on groupby.
For example:
dfMockPos.groupby(['Position']).agg({"relative_age":'mean', "Height": 'mean', "Success_score": "mean", "Weight": "mean" })