image_output_1.png
train = pd.read_csv('../input/car-price/train set.csv')

names = [x.split(' ')[0] for x in list(train['name'])]

train.insert(0, 'brand', names)

train = train.drop(['name', 'seller_type', 'owner', 'torque', 'fuel'], axis=1)

train['engine'] = [int(x.split(' ')[0]) for x in list(train['engine'])]

train['mileage'] = [float(x.split(' ')[0]) for x in list(train['mileage'])]
train['max_power'] = [float(x.split(' ')[0]) for x in list(train['max_power'])]

num_features = [x for x in train.columns if type(train[x][0]) is not str]
cat_features = [x for x in train.columns if x not in num_features]

train.head(3)