Seaborn does not show the bar graphics and others

Question:

I am learning Data Science and I am trying to figure out why I see this difference.
What I get:

import seaborn as sns
import matplotlib.pyplot as plt

from pandas.api.types import CategoricalDtype
diamonds = sns.load_dataset('diamonds')
df= diamonds.copy()
cut_categoriler= ["fair","good","very good","premium","ideal"]
df.cut= df.cut.astype(CategoricalDtype(categories = cut_categoriler, ordered= True))
df.head().T

sns.catplot(x= "cut" ,y= "price",data =df);
plt.show()

enter image description here

what I want:

enter image description here

Asked By: ugur çapan

||

Answers:

Don’t do the cut operation that you are doing. The plot is pretty straightforward.

import seaborn as sns
import matplotlib.pyplot as plt

from pandas.api.types import CategoricalDtype
diamonds = sns.load_dataset('diamonds')
df= diamonds.copy()
df.head()

sns.catplot(x= "cut" ,y= "price",data = df);
plt.show()

enter image description here

Answered By: Gautam Chettiar
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.