text_html_output_1.png
import pandas as pd

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
train = pd.read_csv('../input/train.csv')
test = pd.read_csv('../input/test.csv')

test_ID = test.PassengerId
train = train.drop(['PassengerId', 'Name', 'Ticket'], axis=1)
test = test.drop(['Name', 'Ticket'], axis=1)

age_mean_train = train['Age'].mean()
train['Age'] = train['Age'].fillna(age_mean_train)
age_mean_test = test['Age'].mean()
test['Age'] = test['Age'].fillna(age_mean_test)
print('From train data')
southampton = train[train['Embarked'] == 'S'].shape[0]
cherbourg = train[train['Embarked'] == 'C'].shape[0]
queenstown = train[train['Embarked'] == 'Q'].shape[0]
print('No. of people from Southampton (S) = ', southampton)
print('No. of people from Cherbourg   (C) = ', cherbourg)
print('No. of people from Queenstown  (Q) = ', queenstown)
print('\nFrom test data')
southampton = train[train['Embarked'] == 'S'].shape[0]
cherbourg = train[train['Embarked'] == 'C'].shape[0]
queenstown = train[train['Embarked'] == 'Q'].shape[0]
print('No. of people from Southampton (S) = ', southampton)
print('No. of people from Cherbourg   (C) = ', cherbourg)
print('No. of people from Queenstown  (Q) = ', queenstown)