text_plain_output_1.png
import pandas as pd

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

data_x = data_train[['Pclass', 'Age', 'Sex', 'SibSp', 'Parch', 'Fare', 'Embarked']]
data_y = data_train['Survived']
age_mean = data_x['Age'].dropna().median()
fare_mean = data_x['Fare'].dropna().median()
data_x['Age'].fillna(age_mean, inplace=True)
data_x['Fare'].fillna(fare_mean, inplace=True)
data_x['Embarked'].fillna('S', inplace=True)
for i in range(1, 4):
    data_x.loc[data_x.Pclass == i, 'Pclass'] = str(i)
data_x.head()