text_html_output_1.png
from pandas import Series, DataFrame

import pandas as pd

import seaborn as sns

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

fig = sns.FacetGrid(titanic, hue='Sex', aspect=4)
fig.map(sns.kdeplot, 'Age', shade=True)
oldest = titanic['Age'].max()
fig.set(xlim=(0, oldest))
fig.add_legend()

fig = sns.FacetGrid(titanic, hue='person', aspect=4)
fig.map(sns.kdeplot, 'Age', shade=True)
oldest = titanic['Age'].max()
fig.set(xlim=(0, oldest))
fig.add_legend()

fig = sns.FacetGrid(titanic, hue='Pclass', aspect=4)
fig.map(sns.kdeplot, 'Age', shade=True)
oldest = titanic['Age'].max()
fig.set(xlim=(0, oldest))
fig.add_legend()

deck = titanic['Cabin'].dropna()

levels = []
for level in deck:
    levels.append(level[0])
cabin = DataFrame(levels)
cabin.columns = ['Cabin']

cabin = cabin[cabin.Cabin != 'T']

titanic['Alone'] = titanic.SibSp + titanic.Parch

titanic['Survivor'] = titanic.Survived.map({0: 'No', 1: 'Yes'})

sns.factorplot('Survivor', data=titanic, kind='count')