Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jhu/delphi_jhu/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def geo_map(df: pd.DataFrame, geo_res: str):
Columns: geo_id, timestamp, ...
"""
df = df.copy()
VALID_GEO_RES = ("fips", "state", "msa", "hrr")
VALID_GEO_RES = ("county", "state", "msa", "hrr")
if geo_res not in VALID_GEO_RES:
raise ValueError(f"geo_res must be one of {VALID_GEO_RES}")

gmpr = GeoMapper()
if geo_res == "fips":
if geo_res == "county":
df.rename(columns={'fips': 'geo_id'}, inplace=True)
elif geo_res == "state":
df = gmpr.replace_geocode(df, "fips", "state_id", new_col="geo_id", date_col="timestamp")
Expand Down
2 changes: 1 addition & 1 deletion jhu/delphi_jhu/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"seven_day_average": (seven_day_moving_average, '7dav_'),
}
GEO_RESOLUTIONS = [
"fips",
"county",
"state",
"msa",
"hrr",
Expand Down
2 changes: 1 addition & 1 deletion jhu/tests/test_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_fips(self):

df = df.append(df_mega)

new_df = geo_map(df, "fips")
new_df = geo_map(df, "county")

exp_incidence = df["new_counts"] / df["population"] * 100000
exp_cprop = df["cumulative_counts"] / df["population"] * 100000
Expand Down