Skip to content

Commit

Permalink
Backfill population in island areas (#1882)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbowen-usds committed Sep 26, 2022
1 parent 9fb9874 commit 8e4f80b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/data-pipeline/data_pipeline/etl/score/etl_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,24 @@ class ReversePercentile:
]
].mean(axis=1, skipna=True)

# For AS, MP, GU, and VI, backfill data from the 2010 census where we have it
df_copy = self._backfill_island_data(df_copy)

return df_copy

@staticmethod
def _backfill_island_data(df: pd.DataFrame) -> pd.DataFrame:
logger.info("Backfilling island data")
island_index = (
df[field_names.GEOID_TRACT_FIELD]
.str[:2]
.isin(constants.TILES_ISLAND_AREA_FIPS_CODES)
)
df.loc[island_index, field_names.TOTAL_POP_FIELD] = df.loc[
island_index, field_names.COMBINED_CENSUS_TOTAL_POPULATION_2010
]
return df

def transform(self) -> None:
logger.info("Transforming Score Data")

Expand Down

0 comments on commit 8e4f80b

Please sign in to comment.