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
"""

median_age = train_df['Age'].median()
train_df['Age'] = train_df['Age'].fillna(median_age)
train_df['Embarked'] = train_df['Embarked'].fillna('S')
test_df['Age'] = test_df['Age'].fillna(median_age)
test_df['Fare'] = test_df['Fare'].fillna(0)
test_df['Cabin'] = test_df['Cabin'].fillna('Missing')
train_df['Cabin'] = train_df['Cabin'].fillna('Missing')