Skip to content

Commit 9ff0f46

Browse files
committed
Delphi_utils geomapper: update to fips 2020 population estimates
1 parent ef13336 commit 9ff0f46

15 files changed

+57672
-58469
lines changed

_delphi_utils_python/data_proc/geomap/consistency_checks.ipynb

Lines changed: 0 additions & 888 deletions
This file was deleted.

_delphi_utils_python/data_proc/geomap/geo_data_proc.py

100644100755
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
FIPS_MSA_URL = "https://www2.census.gov/programs-surveys/metro-micro/geographies/reference-files/2018/delineation-files/list1_Sep_2018.xls"
2525
JHU_FIPS_URL = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/UID_ISO_FIPS_LookUp_Table.csv"
2626
STATE_CODES_URL = "http://www2.census.gov/geo/docs/reference/state.txt?#"
27-
FIPS_POPULATION_URL = "https://www2.census.gov/programs-surveys/popest/datasets/2010-2019/counties/totals/co-est2019-alldata.csv"
27+
FIPS_POPULATION_URL = "https://www2.census.gov/programs-surveys/popest/datasets/2010-2020/counties/totals/co-est2020-alldata.csv"
2828
FIPS_PUERTO_RICO_POPULATION_URL = (
2929
"https://www2.census.gov/geo/docs/maps-data/data/rel/zcta_county_rel_10.txt?"
3030
)
@@ -360,32 +360,29 @@ def create_fips_population_table():
360360
)
361361
census_pop["pop"] = census_pop["POPESTIMATE2019"]
362362
census_pop = census_pop[["fips", "pop"]]
363+
364+
# Set population for Dukes and Nantucket combo county
365+
dukes_pop = int(census_pop.loc[census_pop["fips"] == "25007", "pop"])
366+
nantu_pop = int(census_pop.loc[census_pop["fips"] == "25019", "pop"])
363367
census_pop = pd.concat(
364368
[
365369
census_pop,
366370
pd.DataFrame(
367371
{
368-
"fips": ["70002", "70003"],
369-
"pop": [0, 0],
372+
"fips": [
373+
"70002", # Dukes and Nantucket combo county
374+
"70003" # Kansas City
375+
],
376+
"pop": [
377+
dukes_pop + nantu_pop,
378+
491918 # via Google
379+
],
370380
}
371381
),
372382
]
373383
)
374384
census_pop = census_pop.reset_index(drop=True)
375385

376-
# Set population for Dukes and Nantucket
377-
dn_fips = "70002"
378-
dukes_fips = "25007"
379-
nantu_fips = "25019"
380-
381-
census_pop.loc[census_pop["fips"] == dn_fips, "pop"] = (
382-
census_pop.loc[census_pop["fips"] == dukes_fips, "pop"].values
383-
+ census_pop.loc[census_pop["fips"] == nantu_fips, "pop"].values
384-
)
385-
386-
# Set population for Kansas City
387-
census_pop.loc[census_pop["fips"] == "70003", "pop"] = 491918 # via Google
388-
389386
# Get the file with Puerto Rico populations
390387
df_pr = pd.read_csv(FIPS_PUERTO_RICO_POPULATION_URL)
391388
df_pr["fips"] = df_pr["STATE"].astype(str).str.zfill(2) + df_pr["COUNTY"].astype(

_delphi_utils_python/data_proc/geomap/source-file-sanity-check.ipynb

Lines changed: 96 additions & 0 deletions
Large diffs are not rendered by default.

_delphi_utils_python/delphi_utils/data/fips_hhs_table.csv

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ fips,hhs
7171
02020,10
7272
02050,10
7373
02060,10
74+
02063,10
75+
02066,10
7476
02068,10
7577
02070,10
7678
02090,10
@@ -91,7 +93,6 @@ fips,hhs
9193
02220,10
9294
02230,10
9395
02240,10
94-
02261,10
9596
02275,10
9697
02282,10
9798
02290,10
@@ -3234,60 +3235,60 @@ fips,hhs
32343235
69100,9
32353236
69110,9
32363237
69120,9
3237-
78000,2
3238-
33000,1
3239-
09000,1
3240-
32000,9
3241-
04000,9
3242-
30000,8
3243-
15000,9
3244-
69000,9
3245-
25000,1
3246-
19000,7
32473238
01000,4
3248-
51000,3
3249-
41000,10
32503239
66000,9
3251-
22000,6
3252-
06000,9
3253-
39000,5
3254-
38000,8
3255-
53000,10
3256-
12000,4
3257-
46000,8
3258-
17000,5
3259-
48000,6
3260-
34000,2
32613240
08000,8
3241+
12000,4
3242+
37000,4
3243+
09000,1
32623244
36000,2
3263-
40000,6
3264-
47000,4
3245+
29000,7
3246+
21000,4
3247+
35000,6
32653248
49000,8
3266-
45000,4
3267-
55000,5
3268-
11000,3
3269-
02000,10
3249+
69000,9
3250+
18000,5
3251+
24000,3
3252+
78000,2
3253+
26000,5
3254+
46000,8
3255+
38000,8
3256+
10000,3
32703257
72000,2
3271-
23000,1
3272-
16000,10
3273-
44000,1
3258+
05000,6
3259+
40000,6
3260+
22000,6
3261+
02000,10
3262+
17000,5
3263+
42000,3
3264+
55000,5
3265+
31000,7
3266+
32000,9
3267+
53000,10
32743268
54000,3
3275-
10000,3
3276-
21000,4
3269+
60000,9
3270+
44000,1
3271+
19000,7
3272+
30000,8
3273+
27000,5
32773274
28000,4
3278-
18000,5
3279-
05000,6
3275+
33000,1
3276+
34000,2
32803277
56000,8
3281-
24000,3
3278+
45000,4
3279+
48000,6
3280+
15000,9
3281+
06000,9
3282+
41000,10
32823283
50000,1
3283-
37000,4
3284-
20000,7
3285-
31000,7
3286-
29000,7
3287-
27000,5
3284+
23000,1
32883285
13000,4
3289-
42000,3
3290-
35000,6
3291-
60000,9
3292-
26000,5
32933286
70000,9
3287+
16000,10
3288+
20000,7
3289+
04000,9
3290+
51000,3
3291+
11000,3
3292+
39000,5
3293+
25000,1
3294+
47000,4

0 commit comments

Comments
 (0)