File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
google_symptoms/delphi_google_symptoms Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ def geo_map(df, geo_res):
6060 return df
6161
6262 map_df = generate_transition_matrix (geo_res )
63- dfList = []
63+ converted_df = pd . DataFrame ( columns = df . columns )
6464 for _date in df ["timestamp" ].unique ():
6565 newdf = pd .DataFrame ({
6666 "timestamp" : _date ,
@@ -77,6 +77,6 @@ def geo_map(df, geo_res):
7777 newdf ["geo_id" ] = list (map_df .keys ())[1 :]
7878 mask = (newdf [METRICS ].sum (axis = 1 ) == 0 )
7979 newdf .loc [mask , METRICS + ["combined_symptoms" ]] = np .nan
80- dfList .append (newdf )
81- return pd . concat ( dfList )
80+ converted_df = converted_df .append (newdf )
81+ return converted_df
8282
Original file line number Diff line number Diff line change @@ -123,15 +123,14 @@ def pull_gs_data(base_url):
123123 dfs ["state" ] = preprocess (df , "state" )
124124
125125 # For county level data
126- dfList = []
126+ dfs [ "county" ] = pd . DataFrame ( columns = dfs [ "state" ]. columns )
127127 for state in list (STATE_TO_ABBREV .keys ()):
128128 sub_url = "/subregions/" + "%20" .join (state .split ("_" )) + "/"
129- dfList .append (pd .read_csv (base_url .format (sub_url = sub_url ,
130- state = state + "_" ),
131- parse_dates = ["date" ]))
132- df = pd .concat (dfList )
133- df ["geo_id" ] = df ["open_covid_region_code" ].apply (get_geo_id )
134- dfs ["county" ] = preprocess (df , "county" )
129+ df = pd .read_csv (base_url .format (sub_url = sub_url ,
130+ state = state + "_" ),
131+ parse_dates = ["date" ])
132+ df ["geo_id" ] = df ["open_covid_region_code" ].apply (get_geo_id )
133+ dfs ["county" ] = dfs ["county" ].append (preprocess (df , "county" ))
135134
136135 # Add District of Columbia County
137136 try :
You can’t perform that action at this time.
0 commit comments