@vinita I tries this but still it gives me nan values in one of the columns. Here is my code:
ohe = OneHotEncoder(handle_unknown = 'ignore', sparse = False)
train_x_encoded = pd.DataFrame(ohe.fit_transform(train_x[['model', '
vehicleType', 'brand']]))
train_x_encoded.columns = ohe.get_feature_names(['model', 'vehicleType',
'brand'])
train_x.drop(['model', 'vehicleType', 'brand'], axis = 1, inplace = True)
train_x = train_x.reset_index(drop = True)
train_x_encoded = train_x_encoded.reset_index(drop = True)
train_x_final = pd.concat([train_x_encoded, train_x], axis = 1)