application_vnd.jupyter.stderr_output_1.png
from scipy.stats import mode

import pandas as pd

train = pd.read_csv('train.csv')

train.drop(['Name', 'Ticket', 'Cabin'], axis=1, inplace=True)

med_age = train.Age.median()
train.Age = train.Age.fillna(med_age)
train.Embarked = train.Embarked.fillna(train.Embarked.mode())

mode(train.Embarked.tolist())[0][0]

train.Embarked.value_counts()
train.Embarked = train.Embarked.fillna('S')

train['Gender'] = train.Sex.map({'male': 1, 'female': 0})
train['Port'] = train.Embarked.map({'S': 1, 'C': 2, 'Q': 3})
train.info()