text_plain_output_1.png image_output_1.png
import pandas as pd

data = pd.read_csv('/kaggle/input/titanicdataset-traincsv/train.csv')
data

data.count()

a = data.filter(['AgeBin', 'Survived'])
b = a.pivot_table(index='AgeBin', columns=['Survived'], aggfunc=len)
b

data[(data['Sex'] == 'male') & (data['Survived'] == 1)]['Pclass'].value_counts().sort_index().plot(kind='bar', xlabel='Male Survivor', title='Male Survivors Separated by Cabin Class')