I downloaded it in their csv format and whipped up this python program to process it (I hope someone improves on it):
#!/usr/bin/python # -*- coding: utf-8 -*- import re, sys, io, getopt, csv def parse(filename): column_dict = {} list_states = [] val_dict = {} week_dicts = {'2019' : {}, '2020': {}} with open(filename, 'r') as fd: reader = csv.reader(fd, delimiter=',', quotechar='"') for row in reader: if row[0] == 'Jurisdiction of Occurrence': for i, fld in enumerate(row): column_dict[fld] = i unknown_col = column_dict['Symptoms, signs and abnormal clinical and laboratory findings, not elsewhere classified (R00-R99)'] continue yyyymmdd = row[0][:10].replace('-', '') yyyy = row[1] week_num = int(row[2]) tokens = row[3].split('/') yymmdd = "%s%02d%02d" % (tokens[2][-2:], int(tokens[0]), int(tokens[1])) state = row[0] mystery_deaths = row[unknown_col].strip(' ') all_deaths = row[column_dict['All Cause']].strip(' ') if not (state in list_states): list_states.append(state) #print("%s %6s %6s %-s" % (yyyymmdd, mystery_deaths, all_deaths, state)) week_dicts[yyyy][week_num] = yymmdd val_dict[yyyy + str(week_num) + state] = (mystery_deaths, all_deaths) #break num_weeks = len(week_dicts['2020'].keys()) start_week = 4 s = "%15s" % '' s2 = "%15s" % '' for i in range(start_week, num_weeks + 1): s += "%6d " % i s2 += "%s " % week_dicts['2020'][i] print(s) print(s2) tot_w24 = 0 for state in list_states: s = "%-15.15s " % state for week_num in range(start_week, num_weeks + 1): try: (mystery_deaths2020, all_deaths) = val_dict['2020' + str(week_num) + state] (mystery_deaths2019, all_deaths2019) = val_dict['2019' + str(week_num) + state] except KeyError: s += ' ' continue try: delta = (float(mystery_deaths2020 or 0) - float(mystery_deaths2019 or 0)) / float(all_deaths) except ValueError: print("skip %s %s %s %s %s." % (state, week_num, mystery_deaths2019, mystery_deaths2020, all_deaths)) s += ' ' continue if week_num == 24: tot_w24 += float(mystery_deaths2020 or 0) - float(mystery_deaths2019 or 0) s += "%5.2f " % (100*delta) print(s) print("tot_w24 %s" % tot_w24) if __name__ == '__main__': import getopt avail_opts = ['acct=', ] (options, args) = getopt.getopt(sys.argv[1:], '', avail_opts) option_dict = {} for opt in options: option_dict[opt[0][2:]] = opt[1] parse(args[0])
I downloaded it in their csv format and whipped up this python program to process it (I hope someone improves on it):