titanic = pd.read_csv('titanic_data.csv')
survival_by_age = titanic.groupby(['Age', 'Survived']).size().unstack(
    'Survived')
survival_by_age.columns = ['No', 'Yes']
How to create histogram from grouped data