如何在已有变量的水平条形图中对值进行排序
how to sort values in a horizontal bar graph that already has a variable
如何根据 top10[ActiveCases] 对值进行排序?我的语法好像不对。
top10=df[0:21]
top10
plt.barh(top10['Country,Other'],width=top10['ActiveCases'])
plt.title("Top 10 countries with highest active cases")
在创建图表之前使用
top10 = top20
top10.sort_values(by='ActiveCases')
top10.head(10).plot(kind='barh')
这将绘制 10 个最高的国家
top10=df[0:21]
top10
plt.barh(top10['Country,Other'],width=top10['ActiveCases'])
plt.title("Top 10 countries with highest active cases")
在创建图表之前使用
top10 = top20
top10.sort_values(by='ActiveCases')
top10.head(10).plot(kind='barh')
这将绘制 10 个最高的国家