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

import pandas as pd

import seaborn as sns

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

train = train.drop(train[['Cabin', 'Embarked', 'Name', 'Ticket']], axis=1)
test = test.drop(test[['Cabin', 'Embarked', 'Name', 'Ticket']], axis=1)
train.dropna(axis=0, how='any', inplace=True)

corr = train.corr()

train.drop(train[['Fare', 'SibSp', 'Parch']], axis=1, inplace=True)
test.drop(test[['Fare', 'SibSp', 'Parch']], axis=1, inplace=True)

sex_variable = train.pivot_table(index='Sex', values='Survived')

survived = train[train['Survived'] == 1]
died = train[train['Survived'] == 0]
survived['Age'].plot.hist(alpha=0.5, color='red', bins=50)
died['Age'].plot.hist(alpha=0.5, color='blue', bins=50)
plt.legend(['Survived', 'Died'])
plt.show()