text_html_output_1.png image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

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

(train.shape, test.shape)

labels = ('Cherbourg', 'Queenstown', 'Southampton')
sizes = [sum(train['Embarked'] == 'C'), sum(train['Embarked'] == 'Q'), sum(train['Embarked'] == 'S')]
colors = ['yellow', 'aqua', 'lime']
plt.axis('equal')

def survival_stacked_bar(variable):
    Died = train[train['Survived'] == 0][variable].value_counts() / len(train['Survived'] == 0)
    Survived = train[train['Survived'] == 1][variable].value_counts() / len(train['Survived'] == 1)
    data = pd.DataFrame([Died, Survived])
    data.index = ['Did not survived', 'Survived']
    return

f,ax = plt.subplots(figsize=(10, 10))
sns.heatmap(train.corr(), annot=True, linewidths=0.5, fmt= '.2f',ax=ax)

traintestdata = pd.concat([train, test])
traintestdata.shape

traintestdata['Title'] = traintestdata.Name.map(lambda name: name.split(',')[1].split('.')[0].strip())
(train.Title.unique(), test.Title.unique())