text_plain_output_1.png
import pandas as pd

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

gender_submission = pd.read_csv('/kaggle/input/titanic/gender_submission.csv')
test = pd.read_csv('/kaggle/input/titanic/test.csv')
train = pd.read_csv('/kaggle/input/titanic/train.csv')

sex_and_embark_train = pd.get_dummies(train[['Sex', 'Embarked']])
sex_and_embark_test = pd.get_dummies(test[['Sex', 'Embarked']])

train = train.drop(['Sex', 'Embarked'], axis=1)
test = test.drop(['Sex', 'Embarked'], axis=1)

train = train.join(sex_and_embark_train)
test = test.join(sex_and_embark_test)

train.fillna(train.mean(), inplace=True)

X_train = train.drop(['Survived', 'Name', 'Ticket', 'Cabin'], axis=1)
y_train = train['Survived']

y_train