Skip to content

Commit 18a08a5

Browse files
committed
drop split-out county fields; don't always exist in input
1 parent bb7df1a commit 18a08a5

File tree

2 files changed

+404
-411
lines changed

2 files changed

+404
-411
lines changed

_delphi_utils_python/data_proc/geomap/geo_data_proc.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,10 @@ def fetch_county_groups_spreadsheet():
559559
county_groups["state FIPS"] = county_groups["state FIPS"].astype(int)
560560

561561
# Counties belonging to each group are listed (as FIPS codes) in the "county
562-
# FIPS grouping" column, concatenated and separated by the pipe "|". Each
563-
# included FIPS code is also listed in its own unnamed column. County groups
564-
# can contain varying numbers of counties, and if CHNG provides new or updated
565-
# county groupings the number of unnamed columns listing included counties
566-
# could change. Use a general approach to find all of them.
567-
county_cols = [colname for colname in county_groups.columns if colname.startswith("Unnamed: ")]
568-
562+
# FIPS grouping" column, concatenated and separated by the pipe "|".
569563
new_names = {
570564
"state FIPS": "state_fips",
571-
"county FIPS grouping": "fips_list",
572-
**{ colname: ("county" + str(i + 1)) for i, colname in enumerate(county_cols)}
565+
"county FIPS grouping": "fips_list"
573566
}
574567

575568
county_groups = county_groups.rename(

0 commit comments

Comments
 (0)