text_plain_output_1.png
for f in high_cardinality_cols:
    lbl_enc = LabelEncoder()
    lbl_enc.fit(list(train_df[f].values))
    print(f'{f}: {lbl_enc.classes_}')
    train_df[f] = lbl_enc.transform(list(train_df[f].values))
    test_df[f] = lbl_enc.transform(list(test_df[f].values))