text_plain_output_1.png
import numpy as np # linear algebra

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

train_file = pd.read_csv('../input/train.csv')
test_file = pd.read_csv('../input/test.csv')

train_features = train_file[['Pclass', 'Age', 'Sex']].values
target = train_file['Survived'].values

model = DecisionTreeClassifier()
x_train, x_test, y_train, y_test = train_test_split(train_features, target)
model.fit(x_train, y_train)
y_predict = model.predict(x_test)

test_features = test_file[['Pclass', 'Age', 'Sex']].values

test_answer = model.predict(test_features)

PassengerId = np.array(test_file['PassengerId']).astype(int)
solution = pd.DataFrame(test_answer, PassengerId, columns=['Survived'])

solution.shape