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

train_filename = '/kaggle/input/spaceship-titanic/train.csv'
test_filename = '/kaggle/input/spaceship-titanic/test.csv'

df_train = pd.read_csv(train_filename)
df_test = pd.read_csv(test_filename)
df_test_original = df_test.copy()
df_train

def print_unique(df):
    for col in df:
        unique = df[col].unique()
        max_len = 6
        if len(unique) <= max_len:
            unique = [f'{u}({(df[col] == u).sum()})' for u in unique]
        if len(unique) > max_len:
            unique = list(unique[:max_len]) + [f'...({len(unique) - max_len})']
df_train_Y = df_train[['Transported']]
good_columns = ['CryoSleep', 'RoomService', 'FoodCourt', 'ShoppingMall', 'Spa', 'VRDeck']
df_train_X_good_cols = df_train[good_columns]
df_test_X_good_cols = df_test[good_columns]

print_unique(df_train_X_good_cols)