I have multiple dictionaries like this, in which the keys are the age, and the values are the number of the persons with that age. And I grouped them into the multiple dictionaries
age_50 = {39: 66, 40: 83, 42: 217, 43: 53, 23: 33, 21: 28}
age50_80 = {59: 397, 65: 408, 61: 120, 67: 241, 68: 372, 78: 424, 76: 635 }
age_80 = {80: 93, 88: 425, 83: 165, 84: 58, 91: 88}
I want to write it into a CSV file in a way that each column is a dictionary and the rows are the value for each key. I want my output would be the below table. If the key exists, write the value. If not just fill with 0:
Age_Under50 Between_50_80 Greater_80
66 397 0
83 408 93
217 120 425
53 241 0
33 372 165
28 424 58
0 635 88