text_html_output_1.png
import numpy as np

import pandas as pd

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

train = df1.drop(['Ticket', 'Fare', 'Embarked', 'Cabin', 'Name'], axis=1)
test = df2.drop(['Ticket', 'Fare', 'Embarked', 'Cabin', 'Name'], axis=1)

X = train.drop(['Survived'], axis=1)
y = pd.DataFrame(train['Survived'])
X['Age'] = X['Age'].replace(np.nan, X['Age'].mean())
X.head()