text_plain_output_1.png
train_df = train_transactions.merge(train_identity, how='left', on='TransactionID')
del train_transactions, train_identity

test_df = test_df.rename(columns=lambda x: '_'.join(x.split('-')))
train_df.set_index('TransactionID', inplace=True)
test_df.set_index('TransactionID', inplace=True)

train_df.to_pickle('train_df.pkl')
test_df.to_pickle('test_df.pkl')

object_cols = [col for col in train_df.columns if train_df[col].dtype == 'object']
good_label_cols = [col for col in object_cols if set(train_df[col]) == set(test_df[col])]
bad_label_cols = list(set(object_cols) - set(good_label_cols))

object_nunique = list(map(lambda col: train_df[col].nunique(), object_cols))
d = dict(zip(object_cols, object_nunique))
sorted(d.items(), key=lambda x: -x[1])