import seaborn as sns
diamonds = sns.load_dataset('diamonds')
df = diamonds.copy()
df.head()
df.info()
df.describe().T
df.head()
df["cut"].value_counts()
df["color"].value_counts()
# Ordinal Tanımlama
from pandas.api.types import CategoricalDtype
df.cut.head()
df.cut = df.cut.astype(CategoricalDtype(ordered=True))
df.dtypes
df.cut.head(1)
cut_kategoriler = ["Fair", "Good", "Very Good", "Premium", "Ideal"]
df.cut = df.cut.astype(CategoricalDtype(categories=cut_kategoriler, ordered=True))
df.cut
df.cut.head(1)
import pandas as pd
df["cut"].value_counts().plot.barh()
df["cut"].value_counts().plot.barh().set_title("Cut Değişkenin Sınıf Frekansları")
(df["cut"].
value_counts().
plot.barh().
set_title("Cut Değişkenin Sınıf Frekansları"));
(sns.barplot(x = "cut", y = df.cut.index, data = df));
import seaborn as sns
from pandas.api.types import CategoricalDtype
diamonds = sns.load_dataset("diamonds")
df = diamonds.copy()
cut_kategoriler = ["Fair", "Good", "Very Good", "Premium", "Ideal"]
df.cut =df.cut.astype(CategoricalDtype(categories=cut_kategoriler, ordered=True))
df.head()
sns.catplot(x = "cut", y = "price", data=df)
sns.barplot(x = "cut", y="price", hue="color", data=df);
df.groupby(["cut", "color"])["price"].mean()
import seaborn as sns
diamonds = sns.load_dataset('diamonds')
df = diamonds.copy()
df.head()
sns.distplot(df.price, kde = False);
?sns.distplot
sns.distplot(df.price, bins= 1000, kde = False);
sns.distplot(df.price, bins=1000);
sns.distplot(df.price, hist= False);
sns.kdeplot(df.price, shade = True);