text_plain_output_1.png
import matplotlib.pyplot as plt

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

import seaborn as sns

df_train = pd.read_csv('../input/train.csv')

df_train['sex_female'] = df_train['Sex'].apply(lambda x: 1 if x == 'female' else 0)
df_train['age_snr'] = df_train['Age'].apply(lambda x: 1 if x >= 50 else 0)
df_train['age_mid'] = df_train['Age'].apply(lambda x: 1 if x > 10 and x < 50 else 0)
df_train['age_jnr'] = df_train['Age'].apply(lambda x: 1 if x <= 10 else 0)
df_train['known_age'] = df_train['Age'].apply(lambda x: 0 if pd.isnull(x) else 1)
df_train.loc[df_train['known_age'] == 0, 'age_mid'] = 1

train = df_train.drop(['PassengerId', 'Name', 'Sex', 'Ticket', 'Cabin', 'Embarked', 'Age'], axis=1)
fig = plt.subplots(figsize=(20, 10))
sns.heatmap(train.astype(float).corr(), annot=True, cmap='plasma')