text_plain_output_3.png text_plain_output_2.png text_plain_output_1.png
import numpy as np

import numpy as np # linear algebra

import pandas as pd

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

train_df = pd.read_csv('../input/train.csv', dtype={'Age': np.float64})
test_df = pd.read_csv('../input/test.csv', dtype={'Age': np.float64})

"""
Takeaways
Age is null for some rows
Cabin is almost always null
Embarked is null for only 2 rows
"""

"""
Takeaways
Fare is null for one row
Cabin null for most
Age null for some
"""

test_df['Sex'][test_df['Sex'] == 'male'] = 0
test_df['Sex'][test_df['Sex'] == 'female'] = 1
test_df['Embarked'][test_df['Embarked'] == 'S'] = 0
test_df['Embarked'][test_df['Embarked'] == 'C'] = 1
test_df['Embarked'][test_df['Embarked'] == 'Q'] = 2
train_df['Sex'][train_df['Sex'] == 'male'] = 0
train_df['Sex'][train_df['Sex'] == 'female'] = 1
train_df['Embarked'][train_df['Embarked'] == 'S'] = 0
train_df['Embarked'][train_df['Embarked'] == 'C'] = 1
train_df['Embarked'][train_df['Embarked'] == 'Q'] = 2