Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually add population for national data #1938

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion nchs_mortality/delphi_nchs_mortality/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def pull_nchs_mortality_data(token: str, test_file: Optional[str]=None):
geocode_col="state", dropna=False)
df = gmpr.add_geocode(df, "state_name", "state_id",
from_col="state", new_col="geo_id", dropna=False)
# Manually set geo_id for national data
# Manually set geo_id and population for national data
national_pop = gmpr.get_crosswalk("nation", "pop")
us_pop = national_pop.loc[national_pop["nation"] == "us"]["pop"][0]
df.loc[df["state"] == "United States", "population"] = us_pop
df.loc[df["state"] == "United States", "geo_id"] = "us"
return df[keep_columns]
Loading