text_plain_output_2.png application_vnd.jupyter.stderr_output_1.png image_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

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

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

concatenate = [train_data, test_data]

train_data = train_data.drop(['PassengerId', 'Ticket', 'Cabin'], axis=1)
test_data = test_data.drop(['Ticket', 'Cabin'], axis=1)

concatenate = [train_data, test_data]

for dataset in concatenate:
    dataset['Title'] = dataset['Name'].str.extract('([A-Za-z]+)\\.', expand=False)
pd.crosstab(train_data['Title'], train_data['Sex'])