application_vnd.jupyter.stderr_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

train_set = pd.read_csv('train.csv')
test_set = pd.read_csv('test.csv')

cat_cols = ['Survived', 'Sex', 'Pclass', 'Embarked', 'Parch', 'SibSp']
fig, axs = plt.subplots(2, 3, figsize=(16, 9))
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0.3, hspace=0.3)

for i in range(2):
    for j in range(3):
        c = i * 3 + j
        ax = axs[i][j]
    
        sns.countplot(train_set[cat_cols[c]], hue=train_set['Survived'], ax = ax)
        ax.set_title(cat_cols[c], fontsize=14, fontweight='bold')
        ax.grid()

bins = np.arange(0, 80, 5)
g = sns.FacetGrid(train_set, row='Sex', col='Pclass', hue='Survived', margin_titles=True, size=3, aspect=1.1)
g.map(sns.distplot, 'Age', kde=False, bins=bins, hist_kws=dict(alpha=0.6))
g.add_legend()

bins = np.arange(0, 80, 5)
g = sns.FacetGrid(train_set, row='Sex', col='Embarked', hue='Survived', margin_titles=True, size=3, aspect=1.1)
g.map(sns.distplot, 'Age', kde=False, bins=bins, hist_kws=dict(alpha=0.6))
g.add_legend()

bins = np.arange(0, 550, 50)
g = sns.FacetGrid(train_set, row='Sex', col='Pclass', hue='Survived', margin_titles=True, size=3, aspect=1.1)
g.map(sns.distplot, 'Fare', kde=False, bins=bins, hist_kws=dict(alpha=0.6))
g.add_legend()
plt.show()