text_html_output_1.png
import pandas as pd

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

train.drop('id', axis=1, inplace=True)

na_count = pd.Series([train[col].isna().sum() for col in train.columns], index=train.columns, name='NA Count')
na_count

y = train['target']
X = train.drop('target', axis=1)

num_cols = [col for col in X.columns if X[col].dtype in ['int64', 'float64']]
cat_cols = [col for col in X.columns if X[col].dtype == 'object' and X[col].nunique() < 10]

cardinality = pd.Series([X[col].nunique() for col in cat_cols], index=cat_cols, name='Cardinality')
cardinality