text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

path = '../input/'
train = pd.read_csv(path + 'train.csv', na_values=-1)
test = pd.read_csv(path + 'test.csv', na_values=-1)

train.head(5).T

cor = train.corr()

train.isnull().sum().sum()

test.isnull().sum().sum()

train_len = train.shape[0]
df = pd.concat([train, test], axis=0)

bin_col = [c for c in df.columns if df[c].nunique() == 2]
len(bin_col)

other_col = [c for c in df.columns if c not in bin_col]
other_col

def category_type(df):
    col = df.columns
    for i in col:
        if 2 < df[i].nunique() <= 53:
            df[i] = df[i].astype('category')
category_type(df)

fig, ax = plt.subplots(2, 2, figsize=(14, 8))
ax1, ax2, ax3, ax4 = ax.flatten()
sns.countplot(df['X0'], palette='rainbow', ax=ax1)
sns.countplot(df['X1'], palette='summer', ax=ax2)
sns.countplot(df['X2'], palette='rainbow', ax=ax3)
sns.countplot(df['X3'], palette='magma', ax=ax4)