New Create indicators for all thresholds exceeded by a community in Definition L (#980)

* added fieldnames

* todo pollution, water, health & workforce

* workforce

* work in progress

* add utility function to replace duplicate summation logic

* move fpl series into add columns - run black .

* added revisions - still a wip

* added fieldnames

* todo pollution, water, health & workforce

* workforce

* work in progress

* add utility function to replace duplicate summation logic

* move fpl series into add columns - run black .

* added revisions - still a wip

* revise workforce and water

* revise housing and add incremental counter for workforce

* last PR nit

* revise workforce

* more PR feedback in score l

* more PR feedback in score l

* more PR feedback in score l

* addd FPL_SERIES and update references in score 1

* fix bugs

* reparameterize function

* final revisions in fieldnames

* make computations all consistent so we assing with FPL_200_SERIES

* fieldnames refactor after clarification and PR review

* finalize

* finalize with no typos

* fix length

* added median income var

* swap thresholds

* remove iteration

* remove stray '

* address flake 8

* added f string formatting and fixed typos

* added f string formatting and fixed typos

* move up

* remove dupes

* reformat

* fix bugs

* fix bugs

* initialize

Co-authored-by: Saran Ahluwalia <sarahluw@cisco.com>
This commit is contained in:
Saran Ahluwalia 2021-12-05 19:51:19 -05:00 committed by GitHub
commit 07ee4165b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 390 additions and 173 deletions

View file

@ -26,7 +26,7 @@ class DOEEnergyBurden(ExtractTransformLoad):
# Constants for output
self.COLUMNS_TO_KEEP = [
self.GEOID_TRACT_FIELD_NAME,
self.REVISED_ENERGY_BURDEN_FIELD_NAME
self.REVISED_ENERGY_BURDEN_FIELD_NAME,
]
self.raw_df: pd.DataFrame
@ -57,7 +57,7 @@ class DOEEnergyBurden(ExtractTransformLoad):
output_df = self.raw_df.rename(
columns={
self.INPUT_ENERGY_BURDEN_FIELD_NAME : self.REVISED_ENERGY_BURDEN_FIELD_NAME,
self.INPUT_ENERGY_BURDEN_FIELD_NAME: self.REVISED_ENERGY_BURDEN_FIELD_NAME,
self.TRACT_INPUT_COLUMN_NAME: self.GEOID_TRACT_FIELD_NAME,
}
)
@ -79,7 +79,7 @@ class DOEEnergyBurden(ExtractTransformLoad):
def load(self) -> None:
logger.info("Saving DOE Energy Burden CSV")
self.OUTPUT_PATH.mkdir(parents=True, exist_ok=True)
self.output_df[self.COLUMNS_TO_KEEP].to_csv(
path_or_buf=self.OUTPUT_PATH / "usa.csv", index=False