text_html_output_1.png
import pandas as pd

df_train = pd.read_csv('../input/train.csv')
df_test = pd.read_csv('../input/test.csv')

n_train = df_train.shape[0]
n_test = df_test.shape[0]
ratio = round(n_train / (n_train + n_test), 1)

df_train.sample(10)

df_titanic = df_train.drop(['Ticket', 'Cabin', 'Name'], axis=1)

df_titanic_na = df_titanic.dropna()

df_titanic_na.Sex = df_titanic.Sex.map({'female': 0, 'male': 1})
df_titanic_na.Embarked = df_titanic.Embarked.map({'C': 0, 'Q': 1, 'S': 2})

df_titanic_na.head()