text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

train = pd.read_csv('../input/train.csv')
holdout = pd.read_csv('../input/test.csv')

chance_survive = len(train[train['Survived'] == 1]) / len(train['Survived'])

def plot_survival(df, index, color='blue', use_index=True, num_xticks=0, xticks='', position=0.5, legend=['General probabilty of survival']):
    df_pivot = df.pivot_table(index=index, values='Survived')
    if num_xticks > 0:
        plt.xticks(range(num_xticks), xticks)

plot_survival(train, 'Pclass', color='blue', use_index=True)