text_html_output_1.png
import pandas as pd

import pandas as pd
t = pd.read_csv('../input/titanic/train.csv')
t

pd.pivot_table(t, index='SibSp', columns='Parch', values='Survived', aggfunc='count', margins=True)

pd.pivot_table(t, index='SibSp', values='Survived', aggfunc='count', margins=True)

pd.pivot_table(t, index='SibSp', columns='Survived', values='PassengerId', aggfunc='count', margins=True)

t['Title'] = t.Name.str.extract(' ([A-Za-z]+)\\.', expand=False)
pd.crosstab(t['Title'], t['Sex'])

t['Title'] = t['Title'].replace(['Lady', 'Countess', 'Capt', 'Col', 'Don', 'Dr', 'Major', 'Rev', 'Sir', 'Jonkheer', 'Dona'], 'Rare')
t['Title'] = t['Title'].replace('Mlle', 'Miss')
t['Title'] = t['Title'].replace('Ms', 'Miss')
t['Title'] = t['Title'].replace('Mme', 'Mrs')
t[['Title', 'Survived']].groupby(['Title'], as_index=False).mean()