'Cases_Per_Million', 'Deaths_Per_Million') ) csvwriter.writeheader() for code in sorted(d_states_latest.keys()): d = d_states_latest[code] d['Code'] = code if code == 'DE-total': # DE as last row d_de = dict(d) continue csvwriter.writerow( d ) del d, code # add # to uncomment the DE total sum last line d_de['State'] = '# Deutschland' csvwriter.writerow(d_de) del d_de d_ref_states = helper.read_ref_data_de_states() download_new_data() d_states_data = read_csv_to_dict() export_data(d_states_data) export_latest_data(d_ref_states, d_states_data) # 1
]) csvwriter.writeheader() for d in l_time_series: d2 = d gesamt = d2['Int Betten gesamt'] belegt = d2['Int Betten belegt'] if 'Int COVID-19 Patienten' in d2 and d2[ 'Int COVID-19 Patienten'] != None: covid = d2['Int COVID-19 Patienten'] d2['Prozent Int COVID-19 Patienten'] = round( 100 * covid / gesamt, 1) else: d2['Int COVID-19 Patienten'] = None d2['Prozent Int COVID-19 Patienten'] = None d2['Prozent Int Betten belegt'] = round( 100 * belegt / gesamt, 1) csvwriter.writerow(d2) d_states_ref = helper.read_ref_data_de_states() d_states_ref_map_name_code = {} for code, d in d_states_ref.items(): d_states_ref_map_name_code[d['State']] = code fetch_betten() fetch_covid() calc_de_sum() export_time_series() export_data()