How do I sort the values based on top10[ActiveCases]? I don't seem to get the syntax right.
top10=df[0:21]
top10
plt.barh(top10['Country,Other'],width=top10['ActiveCases'])
plt.title("Top 10 countries with highest active cases")
CodePudding user response:
before creating the graph use
top10 = top20
top10.sort_values(by='ActiveCases')
top10.head(10).plot(kind='barh')
this will plot the 10 highest countries