text_html_output_1.png
import matplotlib.pyplot as plt

import numpy as np # linear algebra

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

import seaborn as sns

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

train_set.isnull().sum()

train_set.Survived.value_counts()

np.round(342 * 100 / 891)

np.round(549 * 100 / 891)

g = sns.FacetGrid(train_set, col='Survived')
g.map(plt.hist, 'Age', bins=20)

mean = np.round(train_set.Age.mean())
train_set['Age'] = train_set.Age.fillna(mean)
train_set.Age.isnull().sum()

grid = sns.FacetGrid(train_set, col='Survived')
grid.map(plt.hist, 'Fare')

grid = sns.FacetGrid(train_set, row='Embarked', col='Survived', size=2.2, aspect=1.6)
grid.map(plt.bar, 'Sex', 'Fare')

grid = sns.FacetGrid(train_set, col='Survived', row='Pclass')
grid.map(plt.hist, 'Age')

grid = sns.FacetGrid(train_set, col='Survived', row='Embarked')
grid.map(plt.bar, 'Sex', 'Fare')