I have a dataframe containing the percentage of people in my dataset stratified per Gender and Age.
df_test = pd.DataFrame(data=[['Male','16-24',10],
['Male','25-34',5],
['Male','35-44',2],
['Female','16-24',3],
['Female','25-34',60],
['Female','35-444',20],
],
columns=['Gender','Age','Percentage'])
First I create a plot showig the percentages of Male and Female in the dataset
df_test.groupby('Gender').sum().plot(kind='bar',rot=45)
Now I would like to add within each bar the percentage of people in the age ranges in a stacked kind of way... Could you help ?