text_html_output_1.png
import pandas as pd

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

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

combine = [train_data, test_data]

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