How, can I sort this plot to show from biggest to lowest? I tried to use sort_values but does not work
plt.figure(figsize=(15,8))
sns.countplot(x='arrival_date_month',data=df.sort_values('arrival_date_month',ascending=False))
plt.xticks(rotation=45)
How, can I sort this plot to show from biggest to lowest? I tried to use sort_values but does not work
plt.figure(figsize=(15,8))
sns.countplot(x='arrival_date_month',data=df.sort_values('arrival_date_month',ascending=False))
plt.xticks(rotation=45)
Copyright © 2021 Jogjafile Inc.

The default ordering for a column of type string is the order of occurrence in the dataframe.
You can set a fixed order, either by using the
order=keyword, or by making the columnCategorical.To order from low to high, you can use pandas
df.groupby('...').size().sort_values().indexfor theorder=parameter. Use...[::-1]to reverse that order.Here is some example code: