text_plain_output_1.png
from sklearn.preprocessing import MinMaxScaler

from sklearn.preprocessing import OrdinalEncoder

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

train = pd.read_csv('/kaggle/input/30-days-of-ml/train.csv')
test = pd.read_csv('/kaggle/input/30-days-of-ml/test.csv')

features = train.drop(columns=['target', 'id'], axis=1)
test = test.drop(columns=['id'])
y = train['target']

ordinal_enc = OrdinalEncoder()
categorical = list(features.select_dtypes(include=[object]))
X = features.copy()
X_test = test.copy()
X[categorical] = ordinal_enc.fit_transform(features[categorical])
X_test[categorical] = ordinal_enc.transform(test[categorical])

ordinal_enc = OrdinalEncoder()
categorical = list(features.select_dtypes(include=[object]))
X_scale = features.copy()
X_test_scale = test.copy()
X_scale[categorical] = ordinal_enc.fit_transform(features[categorical])
X_test_scale[categorical] = ordinal_enc.transform(test[categorical])
numerical = list(features.select_dtypes(exclude=[object]))
scaler = MinMaxScaler()
X_scale[numerical] = scaler.fit_transform(features[numerical])
X_test_scale[numerical] = scaler.transform(test[numerical])

X_scale