image_output_1.png
import pandas as pd

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

(train.shape, test.shape)

def survival_stacked_bar(variable):
    Died = train[train['Survived'] == 0][variable].value_counts() / len(train['Survived'] == 0)
    Survived = train[train['Survived'] == 1][variable].value_counts() / len(train['Survived'] == 1)
    data = pd.DataFrame([Died, Survived])
    data.index = ['Did not survived', 'Survived']
    return

survival_stacked_bar('Pclass')