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

def one_hot(df, one_hot_categ):
    for col in one_hot_categ:
        tmp = pd.get_dummies(df[col], prefix=col)
        df = pd.concat([df, tmp], axis=1)
    df = df.drop(columns=one_hot_categ)
    return df

trn_data = one_hot(trn_data, categorical_features_onehot)
tst_data = one_hot(tst_data, categorical_features_onehot)

trn_data.info(verbose=True)