diff --git a/usafacts/delphi_usafacts/geo.py b/usafacts/delphi_usafacts/geo.py index c86bb8ee6..874571621 100644 --- a/usafacts/delphi_usafacts/geo.py +++ b/usafacts/delphi_usafacts/geo.py @@ -25,37 +25,12 @@ ] -FIPS_TO_STATE = {v: k.lower() for k, v in STATE_TO_FIPS.items()} - # Valid geographical resolutions output by this indicator. VALID_GEO_RES = ("county", "state", "msa", "hrr") # Sensors that report proportions. For geo resolutions with unallocated cases # or deaths, we avoid reporting these sensors. PROP_SENSORS = ("incidence", "cumulative_prop") -def fips_to_state(fips: str) -> str: - """Wrapper that handles exceptions to the FIPS scheme in the USAFacts data. - - All the county FIPS codes are mapped to state by taking the first two - digits of the five digit, zero-padded county FIPS and applying - FIPS_TO_STATE to map it to the two-letter postal abbreviation. - - Parameters - ---------- - fips: str - Five digit, zero padded county FIPS code - - Returns - ------- - str - Two-letter postal abbreviation, lower case. - - Raises - ------ - KeyError - Inputted FIPS code not recognized. - """ - return FIPS_TO_STATE[fips[:2]] def disburse(df: pd.DataFrame, pooled_fips: str, fips_list: list): """Disburse counts from POOLED_FIPS equally to the counties in FIPS_LIST. diff --git a/usafacts/delphi_usafacts/pull.py b/usafacts/delphi_usafacts/pull.py index 045e65b38..7e5d8a829 100644 --- a/usafacts/delphi_usafacts/pull.py +++ b/usafacts/delphi_usafacts/pull.py @@ -73,10 +73,6 @@ def pull_usafacts_data(base_url: str, metric: str, geo_mapper: GeoMapper) -> pd. & (df["FIPS"] != 2270) ] - # Merge in population LOWERCASE, consistent across confirmed and deaths - # Population for unassigned cases/deaths is NAN - df = df.merge(pop_df, on="FIPS", how="left") - # Change FIPS from 0 to XX000 for statewise unallocated cases/deaths unassigned_index = (df['FIPS'] == 0) df.loc[unassigned_index, "FIPS"] = df["stateFIPS"].loc[unassigned_index].values * 1000