Skip to content

Commit a3a9131

Browse files
authored
Merge pull request #455 from cmu-delphi/gsymptoms-lint
Fix linting for google symptoms
2 parents 9898e91 + c8c2408 commit a3a9131

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

google_symptoms/delphi_google_symptoms/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@
8080
'Wisconsin': 'wi',
8181
'Wyoming': 'wy'}
8282

83-
DC_FIPS = "11001"
83+
DC_FIPS = "11001"

google_symptoms/delphi_google_symptoms/geo.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def generate_transition_matrix(geo_res):
2121
The first is a data frame for HRR regions and the second are MSA
2222
regions.
2323
"""
24-
map_df = gmpr._load_crosswalk("fips", geo_res)
24+
map_df = gmpr._load_crosswalk("fips", geo_res) # pylint: disable=protected-access
2525
# Add population as weights
2626
map_df = gmpr.add_population_column(map_df, "fips")
2727
if geo_res == "hrr":
@@ -31,7 +31,7 @@ def generate_transition_matrix(geo_res):
3131
msa_pop, on=geo_res, how="inner", suffixes=["_raw", "_groupsum"]
3232
)
3333
map_df["weight"] = map_df["population_raw"] / map_df["population_groupsum"]
34-
34+
3535
map_df = pd.pivot_table(
3636
map_df, values='weight', index=["fips"], columns=[geo_res]
3737
).fillna(0).reset_index().rename({"fips": "geo_id"}, axis = 1)
@@ -52,13 +52,13 @@ def geo_map(df, geo_res):
5252
Returns
5353
-------
5454
pd.DataFrame
55-
A dataframe with columns "geo_id", "timestamp",
56-
and columns for signal vals.
55+
A dataframe with columns "geo_id", "timestamp",
56+
and columns for signal vals.
5757
The geo_id has been converted from fips to HRRs/MSAs
5858
"""
5959
if geo_res in set(["county", "state"]):
6060
return df
61-
61+
6262
map_df = generate_transition_matrix(geo_res)
6363
converted_df = pd.DataFrame(columns = df.columns)
6464
for _date in df["timestamp"].unique():
@@ -75,4 +75,4 @@ def geo_map(df, geo_res):
7575
newdf[mask] = np.nan
7676
converted_df = converted_df.append(newdf)
7777
return converted_df
78-
78+

google_symptoms/delphi_google_symptoms/pull.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def preprocess(df, level):
4343
"""
4444
# Constants
4545
KEEP_COLUMNS = ["geo_id", "date"] + METRICS + ["combined_symptoms"]
46-
46+
4747
df["combined_symptoms"] = 0
4848
for metric in METRICS:
4949
df.rename({"symptom:" + metric: metric}, axis = 1, inplace = True)
@@ -52,7 +52,7 @@ def preprocess(df, level):
5252
(df["Anosmia"].isnull())
5353
& (df["Ageusia"].isnull())
5454
, "combined_symptoms"] = np.nan
55-
55+
5656
# Delete rows with missing FIPS
5757
null_mask = (df["geo_id"].isnull())
5858
df = df.loc[~null_mask]

google_symptoms/delphi_google_symptoms/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def run_module():
2323
base_url = params["base_url"]
2424

2525
# Pull GS data
26-
dfs = pull_gs_data(base_url)
26+
dfs = pull_gs_data(base_url)
2727
for geo_res in GEO_RESOLUTIONS:
2828
if geo_res == "state":
2929
df_pull = dfs["state"]
@@ -48,4 +48,4 @@ def run_module():
4848
start_date=SMOOTHERS_MAP[smoother][1](export_start_date),
4949
metric=metric.lower(),
5050
geo_res=geo_res,
51-
sensor=sensor_name)
51+
sensor=sensor_name)

0 commit comments

Comments
 (0)