Skip to content

Commit 0d10717

Browse files
authored
Merge pull request #638 from cmu-delphi/dv-fix-rows
Keep thresholded counties for future calculations
2 parents 766bba5 + d34b9ab commit 0d10717

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

doctor_visits/delphi_doctor_visits/geo_maps.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,14 @@ def county_to_megacounty(self, data, threshold_visits, threshold_len):
101101
102102
Returns: tuple of dataframe at the daily-state resolution, and geo_id column name
103103
"""
104-
data = self.gmpr.fips_to_megacounty(data,
104+
all_data = self.gmpr.fips_to_megacounty(data,
105105
threshold_visits,
106106
threshold_len,
107107
fips_col="PatCountyFIPS",
108108
thr_col="Denominator",
109109
date_col="ServiceDate")
110-
data.rename({"megafips": "PatCountyFIPS"}, axis=1, inplace=True)
110+
all_data.rename({"megafips": "PatCountyFIPS"}, axis=1, inplace=True)
111+
megacounties = all_data[all_data.PatCountyFIPS.str.endswith("000")]
112+
data = pd.concat([data, megacounties])
113+
111114
return data.groupby("PatCountyFIPS"), "PatCountyFIPS"

doctor_visits/tests/test_geomap.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ def test_county_to_megacounty(self):
4646
assert name == "PatCountyFIPS"
4747
assert set(out.groups.keys()) == {
4848
"01001",
49+
"01003",
4950
"01005",
51+
"01007",
5052
"01009",
53+
"01011",
54+
"01013",
5155
"01015",
56+
"01017",
5257
"01000"
5358
}

0 commit comments

Comments
 (0)