text_html_output_1.png
import pandas as pd

df = pd.read_csv('../input/train.csv', encoding='ISO-8859-1', low_memory=False)

df.columns.values

df['Age_band'] = 0
df.loc[df['Age'] <= 16, 'Age_band'] = 0
df.loc[(df['Age'] > 16) & (df['Age'] <= 32), 'Age_band'] = 1
df.loc[(df['Age'] > 32) & (df['Age'] <= 48), 'Age_band'] = 2
df.loc[(df['Age'] > 48) & (df['Age'] <= 64), 'Age_band'] = 3
df.loc[df['Age'] > 64, 'Age_band'] = 4

df.Age.isnull().sum()

pd.crosstab(df.Pclass, df.Survived, margins=True).style.background_gradient(cmap='summer_r')