text_plain_output_5.png application_vnd.jupyter.stderr_output_2.png application_vnd.jupyter.stderr_output_4.png application_vnd.jupyter.stderr_output_6.png application_vnd.jupyter.stderr_output_3.png text_plain_output_7.png text_plain_output_8.png application_vnd.jupyter.stderr_output_1.png
from subprocess import check_output

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import numpy as np
import pandas as pd
from subprocess import check_output
titanic = pd.read_csv('../input/train.csv')
titanic_test = pd.read_csv('../input/test.csv')

titanic['Age'] = titanic['Age'].fillna(titanic['Age'].median())

titanic.loc[titanic['Sex'] == 'male', 'Sex'] = 0
titanic.loc[titanic['Sex'] == 'female', 'Sex'] = 1
titanic['Embarked'] = titanic['Embarked'].fillna('S')
titanic.loc[titanic['Embarked'] == 'S', 'Embarked'] = 0
titanic.loc[titanic['Embarked'] == 'C', 'Embarked'] = 1
titanic.loc[titanic['Embarked'] == 'Q', 'Embarked'] = 2
print(titanic['Embarked'].unique())