text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
train = pd.read_csv('/kaggle/input/diamonds/diamonds.csv')
train

train.isnull().sum()

Q1 = train['carat'].quantile(0.25)
Q3 = train['carat'].quantile(0.75)
IQR = Q3 - Q1
train = train[(train['carat'] >= Q1 - 1.5 * IQR) & (train['carat'] <= Q3 + 1.5 * IQR)]

from sklearn.preprocessing import LabelEncoder
labelencoder_cut = LabelEncoder()
train['cut'] = labelencoder_cut.fit_transform(train['cut'])
labelencoder_color = LabelEncoder()
train['color'] = labelencoder_color.fit_transform(train['color'])
labelencoder_clarity = LabelEncoder()
train['clarity'] = labelencoder_clarity.fit_transform(train['clarity'])
train.info()