text_plain_output_1.png
import matplotlib.pyplot as plt

import seaborn as sns

train = pd.read_csv(dirname + '/train.csv')
test = pd.read_csv(dirname + '/test.csv')
pid_test = test['PassengerId']

pct_missing = round(train.isnull().sum() / train.isnull().count() * 100, 1)
pct_missing.sort_values(ascending=False).head()

print('Survival rate with respect to the port of embarkation:')
print('\tS: {} %'.format(train[(train.Embarked == 'S') & (train.Survived == 1)]['Survived'].count() / len(train[train.Embarked == 'S']) * 100))
print('\tC: {} %'.format(train[(train.Embarked == 'C') & (train.Survived == 1)]['Survived'].count() / len(train[train.Embarked == 'C']) * 100))
print('\tQ: {} %'.format(train[(train.Embarked == 'Q') & (train.Survived == 1)]['Survived'].count() / len(train[train.Embarked == 'Q']) * 100))