Skip to content

Commit dd5e3f2

Browse files
authored
Merge pull request #421 from sgsmob/usafacts
Remove extraneous functions and calls from usafacts
2 parents 7fe7294 + 1142a77 commit dd5e3f2

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

usafacts/delphi_usafacts/geo.py

-25
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,12 @@
2525
]
2626

2727

28-
FIPS_TO_STATE = {v: k.lower() for k, v in STATE_TO_FIPS.items()}
29-
3028
# Valid geographical resolutions output by this indicator.
3129
VALID_GEO_RES = ("county", "state", "msa", "hrr")
3230
# Sensors that report proportions. For geo resolutions with unallocated cases
3331
# or deaths, we avoid reporting these sensors.
3432
PROP_SENSORS = ("incidence", "cumulative_prop")
3533

36-
def fips_to_state(fips: str) -> str:
37-
"""Wrapper that handles exceptions to the FIPS scheme in the USAFacts data.
38-
39-
All the county FIPS codes are mapped to state by taking the first two
40-
digits of the five digit, zero-padded county FIPS and applying
41-
FIPS_TO_STATE to map it to the two-letter postal abbreviation.
42-
43-
Parameters
44-
----------
45-
fips: str
46-
Five digit, zero padded county FIPS code
47-
48-
Returns
49-
-------
50-
str
51-
Two-letter postal abbreviation, lower case.
52-
53-
Raises
54-
------
55-
KeyError
56-
Inputted FIPS code not recognized.
57-
"""
58-
return FIPS_TO_STATE[fips[:2]]
5934

6035
def disburse(df: pd.DataFrame, pooled_fips: str, fips_list: list):
6136
"""Disburse counts from POOLED_FIPS equally to the counties in FIPS_LIST.

usafacts/delphi_usafacts/pull.py

-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ def pull_usafacts_data(base_url: str, metric: str, geo_mapper: GeoMapper) -> pd.
7373
& (df["FIPS"] != 2270)
7474
]
7575

76-
# Merge in population LOWERCASE, consistent across confirmed and deaths
77-
# Population for unassigned cases/deaths is NAN
78-
df = df.merge(pop_df, on="FIPS", how="left")
79-
8076
# Change FIPS from 0 to XX000 for statewise unallocated cases/deaths
8177
unassigned_index = (df['FIPS'] == 0)
8278
df.loc[unassigned_index, "FIPS"] = df["stateFIPS"].loc[unassigned_index].values * 1000

0 commit comments

Comments
 (0)