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

train_df = pd.read_csv('../input/train.csv')
test_df = pd.read_csv('../input/test.csv')
test_y = pd.read_csv('../input/gender_submission.csv')
X_train = train_df[['Pclass', 'Sex', 'Age', 'SibSp', 'Parch', 'Fare', 'Embarked']]
sex = pd.get_dummies(X_train['Sex'])
X_train = X_train.drop(['Sex'], axis=1)
X_train = X_train.join(sex)
embarked = pd.get_dummies(X_train['Embarked'])
X_train = X_train.drop(['Embarked'], axis=1)
X_train = X_train.join(embarked)
Y_train = train_df.drop(['PassengerId', 'Ticket', 'Cabin', 'Pclass', 'Sex', 'Age', 'SibSp', 'Parch', 'Fare', 'Embarked', 'Name'], axis=1)
X_test = test_df[['Pclass', 'Sex', 'Age', 'SibSp', 'Parch', 'Fare', 'Embarked']]
sex = pd.get_dummies(X_test['Sex'])
X_test = X_test.drop(['Sex'], axis=1)
X_test = X_test.join(sex)
embarked = pd.get_dummies(X_test['Embarked'])
X_test = X_test.drop(['Embarked'], axis=1)
X_test = X_test.join(embarked)
Y_test = test_y.drop('PassengerId', axis=1).copy()
X_train.head()