I have a pandas dataframe by using this code:
frame['count'] = 1
frame['age_group'] = pd.cut(frame.age, [0,10,20,30,40,50,60,70,80,90,100])
age_grp = frame.pivot_table('count', index='age_group', columns='gender', aggfunc='sum').fillna(0).
and the dataframe looks like this
gender F M
age_group
(0, 10] 0.0 0.0
(10, 20] 0.0 0.0
(20, 30] 2.0 0.0
(30, 40] 6.0 5.0
(40, 50] 15.0 4.0
(50, 60] 35.0 24.0
(60, 70] 47.0 30.0
(70, 80] 24.0 6.0
(80, 90] 1.0 2.0
(90, 100] 0.0 0.0
How can I loop this dataframe properly? im planning to use a double bar chart using chartjs with this data.
*attempting to try this iterate over pandas dataframe in jinja2
{% for key,value in x.iterrows() %}
<option value="{{ value['id'] }}">{{ value['text'] }}</option>
{% endfor %}
trying to print the boundaries.