2021年5月4日星期二

How do I sort the average of a group using Python Pandas?

The data frame has country, height, and many other columns. I want to report the average height by country and sort it with the highest average on top. I am stuck at the sort. So far, I have this.

cH = df.("Country")["Height"].mean()  

This allowed me to find the average height per country. However, now I need to sort this.

https://stackoverflow.com/questions/67394614/how-do-i-sort-the-average-of-a-group-using-python-pandas May 05, 2021 at 10:59AM

没有评论:

发表评论