I have a dataframe that is using the following classification:
First column: 'high', 'low', 'med', 'vhigh' (very high)
Second column: 'acc': acceptable, 'unacc': unacceptable, 'good' and 'vgood'
But when I plot it, the graph is not the most intuitive one:
When I am using groupby, it's sorting alphabetically. I'd like to see it in an order like: 'unacc', 'acc', 'good', 'vgood'
How could I change the dataframe to use this order?
df_buy_class = df.groupby(['buying', 'classification']).count().reset_index()
df_buy_class.rename(columns={'maint': 'number of cars'}, inplace=True)
fig = plt.figure(figsize=(40,5))
sns.catplot(x='classification', y='number of cars', hue='buying', kind="bar", data = df_buy_class)
plt.show()