text_plain_output_1.png
import pandas as pd

data = pd.read_csv('../input/diamonds/diamonds.csv')

data.dtypes

data = data.drop(data.loc[data.x <= 0].index)
data = data.drop(data.loc[data.y <= 0].index)
data = data.drop(data.loc[data.z <= 0].index)

data['ratio'] = data.x / data.y

premium = ['D', 'E', 'F', 'G', 'H']
def data_split(status):
    if status in premium:
        return 'premium'
    else:
        return 'normal'
def data_split_num(status):
    if status in premium:
        return 1
    else:
        return 0
data['data_split'] = data['color'].apply(data_split)
data['data_split_num'] = data['color'].apply(data_split_num)
data.head()