text_plain_output_1.png
from sklearn.linear_model import LogisticRegression

from sklearn.metrics import accuracy_score

import pandas as pd

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

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

df_titanic_train.drop(labels=['Cabin'], axis=1, inplace=True)
df_titanic_test.drop(labels=['Cabin'], axis=1, inplace=True)

df_titanic_train.drop(labels=['PassengerId', 'Name', 'Ticket'], axis=1, inplace=True)
df_titanic_test.drop(labels=['PassengerId', 'Name', 'Ticket'], axis=1, inplace=True)

df_titanic_train.isna().sum()

df_titanic_test.isna().sum()

model = LogisticRegression()
x = df_titanic_train.loc[:, df_titanic_train.columns != 'Survived']
y = df_titanic_train['Survived']
model.fit(x, y)
y_pred = model.predict(df_titanic_test)

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

df_true_answers = df_gender_submission['Survived']

print(accuracy_score(df_true_answers, y_pred) * 100)