Skip to content

Commit

Permalink
add population by age group in by_age_group.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Bevand committed Mar 8, 2022
1 parent 98c4503 commit a3a5140
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 57 deletions.
108 changes: 54 additions & 54 deletions by_age_group.csv
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
Jurisdiction,Excess (CDC reference),Excess,Difference Percent,Excess Under 25,Excess 25-44,Excess 45-64,Excess 65-74,Excess 75-84,Excess 85+
United States,1078226,1064325,-1.2892473377566493,12769,87021,255603,251084,260506,197342
California,107848,107174,-0.6249536384541177,1835,11425,28761,22780,22887,19485
Texas,106624,105207,-1.3289690876350568,1203,9691,27748,25811,24124,16629
Florida,78680,78506,-0.22114895780376287,735,5629,16917,16888,20618,17719
New York,74083,74495,0.5561329859751885,560,4951,16579,16868,18775,16764
Ohio,41518,42156,1.5366828845320146,301,2420,9238,10850,10500,8847
Pennsylvania,40939,42692,4.28198050758446,316,1491,8621,11463,11403,9399
Georgia,40183,39710,-1.1771147002463733,416,3579,10238,9020,9978,6480
Illinois,38433,38426,-0.018213514427700694,660,2257,8668,9563,9342,7937
Michigan,37664,36764,-2.3895497026338197,411,2333,8755,9342,9554,6369
Arizona,34860,34897,0.10613884107859572,306,3215,8520,8660,8632,5564
Tennessee,29642,29334,-1.0390661898657338,191,3347,7503,7454,6482,4357
New Jersey,29462,29577,0.3903333107053264,96,667,6861,7052,8478,6423
North Carolina,24489,20298,-17.113806198701454,582,2800,5893,4626,4323,2074
Virginia,23595,24497,3.8228438228438133,469,2214,5412,5465,6017,4921
Alabama,23314,23359,0.1930170712876489,242,1904,6733,5273,5451,3757
Indiana,23112,23317,0.8869851159570841,383,1721,5176,5702,5982,4353
South Carolina,21247,21772,2.4709370734691927,239,2006,5280,5405,4954,3887
Missouri,20290,19985,-1.5032035485460837,,1132,4613,4669,5180,4392
Louisiana,19405,18953,-2.3292965730481785,387,1997,4930,4420,4495,2724
Kentucky,17252,17231,-0.12172501738928476,590,1937,4648,4235,3650,2172
Mississippi,16626,16172,-2.7306628172741543,298,1584,4142,3839,3803,2506
Colorado,15586,15616,0.1924804311561612,279,1726,3337,3344,4044,2886
Oklahoma,15583,15295,-1.848167875248663,235,1426,3649,3752,3649,2584
Wisconsin,15490,14360,-7.295029051000645,146,1310,3082,3469,3602,2751
Washington,14248,13936,-2.1897810218978075,309,1487,3210,2765,3388,2776
Maryland,14060,14253,1.3726884779516446,207,602,2939,3489,3939,3077
Massachusetts,14026,13499,-3.7573078568372997,110,575,2185,3145,4467,3018
Arkansas,12834,13440,4.721832632071066,211,1445,3647,3461,2577,2099
Minnesota,11572,10989,-5.038022813688214,82,1041,2362,2621,2798,2084
Nevada,11441,11533,0.8041255135040615,259,1266,2883,2703,2860,1563
Oregon,11294,10644,-5.755268284044623,181,1029,2353,2245,2631,2204
Connecticut,10886,10019,-7.964357890869012,79,513,2333,2184,2992,1917
New Mexico,9389,9017,-3.962083288955165,137,1339,2485,1785,2028,1243
Kansas,9291,9258,-0.355182434614143,180,759,2037,2161,2290,1831
Iowa,8472,7780,-8.168083097261569,-88,400,1355,1993,2189,1930
West Virginia,6804,5520,-18.87125220458554,30,489,1614,1688,974,726
Utah,6509,5966,-8.342295283453682,-99,519,1729,1470,1264,1083
Idaho,5527,5351,-3.184367649719555,57,548,1484,1258,1187,817
Puerto Rico,4825,599,-87.58549222797927,115,-215,452,358,367,-478
Nebraska,4515,4140,-8.30564784053156,104,217,825,1071,1196,727
Montana,4407,4021,-8.75879282958929,,441,1111,906,848,715
Maine,3283,3284,0.030459945172101044,,308,842,743,737,654
Rhode Island,3280,3045,-7.164634146341465,,133,761,418,805,927
Delaware,3207,3539,10.35235422513252,,58,639,1105,1074,663
South Dakota,3088,2702,-12.5,16,249,559,685,635,559
North Dakota,2437,2010,-17.52154288059089,,203,575,554,552,125
Wyoming,2318,1855,-19.974115616911124,,46,514,572,559,165
New Hampshire,2144,2225,3.777985074626855,,259,88,628,794,456
Alaska,2085,1927,-7.577937649880095,,258,604,432,376,257
Vermont,2014,1970,-2.1847070506454846,,49,444,319,574,584
District of Columbia,1736,1303,-24.942396313364057,22,362,325,349,155,90
Hawaii,1434,1293,-9.832635983263593,,,399,326,596,-29
Jurisdiction,Excess (CDC reference),Excess,Difference Percent,Excess Under 25,Excess 25-44,Excess 45-64,Excess 65-74,Excess 75-84,Excess 85+,Pop Under 25,Pop 25-44,Pop 45-64,Pop 65-74,Pop 75-84,Pop 85+
United States,1078226,1064325,-1.2892473377566493,12769,87021,255603,251084,260506,197342,102411805,87518831,82707201,32549398,16451547,6658420
California,107848,107174,-0.6249536384541177,1835,11425,28761,22780,22887,19485,12328171,11238995,9668677,3469545,1750249,756372
Texas,106624,105207,-1.3289690876350568,1203,9691,27748,25811,24124,16629,10226987,8275739,6870014,2339912,1119841,413930
Florida,78680,78506,-0.22114895780376287,735,5629,16917,16888,20618,17719,5972197,5424371,5631726,2539576,1502209,596309
New York,74083,74495,0.5561329859751885,560,4951,16579,16868,18775,16764,5700830,5254521,4986916,1912722,996328,460519
Ohio,41518,42156,1.5366828845320146,301,2420,9238,10850,10500,8847,3614909,2965880,3006030,1233236,608792,255610
Pennsylvania,40939,42692,4.28198050758446,316,1491,8621,11463,11403,9399,3742467,3236401,3350321,1401258,717789,328640
Georgia,40183,39710,-1.1771147002463733,416,3579,10238,9020,9978,6480,3492429,2868404,2711662,959264,459814,155589
Illinois,38433,38426,-0.018213514427700694,660,2257,8668,9563,9342,7937,3900739,3366918,3203140,1211741,610637,266856
Michigan,37664,36764,-2.3895497026338197,411,2333,8755,9342,9554,6369,3054226,2486191,2609988,1074762,525966,211713
Arizona,34860,34897,0.10613884107859572,306,3215,8520,8660,8632,5564,2340793,1933226,1753780,786905,434972,152098
Tennessee,29642,29334,-1.0390661898657338,191,3347,7503,7454,6482,4357,2117862,1804925,1763153,704870,351752,123921
New Jersey,29462,29577,0.3903333107053264,96,667,6861,7052,8478,6423,2676875,2289702,2396442,859409,449250,201369
North Carolina,24489,20298,-17.113806198701454,582,2800,5893,4626,4323,2074,3257147,2703913,2727736,1084482,535819,194241
Virginia,23595,24497,3.8228438228438133,469,2214,5412,5465,6017,4921,2633645,2248364,2192264,827566,416842,156636
Alabama,23314,23359,0.1930170712876489,242,1904,6733,5273,5451,3757,1531001,1238207,1263987,517717,263668,92859
Indiana,23112,23317,0.8869851159570841,383,1721,5176,5702,5982,4353,2222282,1730610,1683936,658882,325212,131191
South Carolina,21247,21772,2.4709370734691927,239,2006,5280,5405,4954,3887,1564947,1301426,1333567,593048,289033,94294
Missouri,20290,19985,-1.5032035485460837,,1132,4613,4669,5180,4392,1920243,1577804,1544873,630388,325373,133953
Louisiana,19405,18953,-2.3292965730481785,387,1997,4930,4420,4495,2724,1492771,1236695,1136176,458282,222201,83267
Kentucky,17252,17231,-0.12172501738928476,590,1937,4648,4235,3650,2172,1407712,1132400,1149279,462362,226031,82442
Mississippi,16626,16172,-2.7306628172741543,298,1584,4142,3839,3803,2506,967503,746346,738277,298209,148431,53315
Colorado,15586,15616,0.1924804311561612,279,1726,3337,3344,4044,2886,1765224,1718001,1412174,543363,241734,91290
Oklahoma,15583,15295,-1.848167875248663,235,1426,3649,3752,3649,2584,1326999,1040479,940403,380547,197625,74987
Wisconsin,15490,14360,-7.295029051000645,146,1310,3082,3469,3602,2751,1802324,1460889,1518325,620424,300842,126669
Washington,14248,13936,-2.1897810218978075,309,1487,3210,2765,3388,2776,2305967,2214200,1873401,758505,353988,135381
Maryland,14060,14253,1.3726884779516446,207,602,2939,3489,3939,3077,1847365,1594162,1591367,578509,288312,120531
Massachusetts,14026,13499,-3.7573078568372997,110,575,2185,3145,4467,3018,2024537,1852174,1813528,693841,346191,158370
Arkansas,12834,13440,4.721832632071066,211,1445,3647,3461,2577,2099,977032,768087,743839,310489,164712,61105
Minnesota,11572,10989,-5.038022813688214,82,1041,2362,2621,2798,2084,1794910,1498689,1412766,552208,273886,122747
Nevada,11441,11533,0.8041255135040615,259,1266,2883,2703,2860,1563,947795,875199,785121,316112,156290,46914
Oregon,11294,10644,-5.755268284044623,181,1029,2353,2245,2631,2204,1220597,1184785,1044019,478552,226478,84497
Connecticut,10886,10019,-7.964357890869012,79,513,2333,2184,2992,1917,1054286,876408,973406,363764,191658,90574
New Mexico,9389,9017,-3.962083288955165,137,1339,2485,1785,2028,1243,664853,537421,502481,231746,115866,42299
Kansas,9291,9258,-0.355182434614143,180,759,2037,2161,2290,1831,979887,733601,689265,282458,140371,65487
Iowa,8472,7780,-8.168083097261569,-88,400,1355,1993,2189,1930,1039185,788112,768326,323349,164692,78095
West Virginia,6804,5520,-18.87125220458554,30,489,1614,1688,974,726,509448,425479,475321,222176,111083,40310
Utah,6509,5966,-8.342295283453682,-99,519,1729,1470,1264,1083,1295670,926671,641109,230052,112018,39523
Idaho,5527,5351,-3.184367649719555,57,548,1484,1258,1187,817,617812,473447,426122,185942,89638,30414
Puerto Rico,4825,599,-87.58549222797927,115,-215,452,358,367,-478,876008,793549,844481,366490,221970,91196
Nebraska,4515,4140,-8.30564784053156,104,217,825,1071,1196,727,661958,496504,453047,185015,91792,42630
Montana,4407,4021,-8.75879282958929,,441,1111,906,848,715,326311,272254,265058,129574,60746,23072
Maine,3283,3284,0.030459945172101044,,308,842,743,737,654,353849,320323,380825,175368,84783,33625
Rhode Island,3280,3045,-7.164634146341465,,133,761,418,805,927,308179,272509,279529,110332,55188,26957
Delaware,3207,3539,10.35235422513252,,58,639,1105,1074,663,286337,243301,256157,118462,58528,20604
South Dakota,3088,2702,-12.5,16,249,559,685,635,559,300377,221273,210428,94041,42280,20856
North Dakota,2437,2010,-17.52154288059089,,203,575,554,552,125,261860,204140,168991,69658,34850,18633
Wyoming,2318,1855,-19.974115616911124,,46,514,572,559,165,184470,149872,141111,63814,28948,11014
New Hampshire,2144,2225,3.777985074626855,,259,88,628,794,456,375182,333978,392678,158927,73622,30580
Alaska,2085,1927,-7.577937649880095,,258,604,432,376,257,238701,202830,174317,64158,24379,7339
Vermont,2014,1970,-2.1847070506454846,,49,444,319,574,584,177663,147151,169367,77613,36624,14357
District of Columbia,1736,1303,-24.942396313364057,22,362,325,349,155,90,200690,275210,143378,51557,25986,12290
Hawaii,1434,1293,-9.832635983263593,,,399,326,596,-29,396601,350644,339398,154706,78228,42146
9 changes: 6 additions & 3 deletions by_age_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ def chart():
print(f'{epm:5.0f} excess/1M {jurisdiction:20} {obs - exp:7.0f} excess')
chart_group(g, my_excess[g])

def comp_cdc():
def output_csv():
f = open('by_age_group.csv', 'w')
f.write('Jurisdiction,Excess (CDC reference),Excess,Difference Percent,'
'Excess Under 25,Excess 25-44,Excess 45-64,Excess 65-74,Excess 75-84,Excess 85+\n')
'Excess Under 25,Excess 25-44,Excess 45-64,Excess 65-74,Excess 75-84,Excess 85+,'
'Pop Under 25,Pop 25-44,Pop 45-64,Pop 65-74,Pop 75-84,Pop 85+\n')
for (epm, obs, exp, jurisdiction) in sorted(my_excess['all'], key=lambda x: -cdc_excess[x[3]]):
cdc = cdc_excess[jurisdiction]
our = round(obs - exp)
Expand All @@ -336,6 +337,8 @@ def comp_cdc():
if ff:
_, obs, exp, _ = ff[0]
f.write(f'{obs - exp:.0f}')
for group in ('Under 25 years', '25-44 years', '45-64 years', '65-74 years', '75-84 years', '85 years and older'):
f.write(f',{pop[jurisdiction][group]}')
f.write('\n')
f.close()

Expand All @@ -349,7 +352,7 @@ def main():
else:
my_excess = json.load(open(cache))
load_cdc_official()
comp_cdc()
output_csv()
chart()

main()

0 comments on commit a3a5140

Please sign in to comment.