text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import numpy as np # linear algebra

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

train_set = pd.read_csv('../input/train.csv')
test_set = pd.read_csv('../input/test.csv')

train_set.isnull().sum()

train_set.Survived.value_counts()

np.round(342 * 100 / 891)

np.round(549 * 100 / 891)

mean = np.round(train_set.Age.mean())
train_set['Age'] = train_set.Age.fillna(mean)
train_set.Age.isnull().sum()

X_train = train_set.drop(['Survived', 'PassengerId', 'Name', 'Parch', 'Ticket', 'Cabin'], axis=1)
X_train = X_train.values

labelEncoder = LabelEncoder()
X_train[:, 5] = labelEncoder.fit_transform(X_train[:, 5])
print(X_train)