Merge branch 'main' into justice40-tool-iss-751

This commit is contained in:
VincentLaUSDS 2021-11-29 13:39:56 -05:00
commit 32f8f36ca9
2 changed files with 12 additions and 14 deletions

View file

@ -3,6 +3,7 @@ import pandas as pd
from data_pipeline.etl.base import ExtractTransformLoad
from data_pipeline.utils import get_module_logger, zip_files
from data_pipeline.etl.sources.census.etl_utils import (
check_census_data_source,
)
@ -102,11 +103,13 @@ class PostScoreETL(ExtractTransformLoad):
"""
# Rename some of the columns to prepare for merge
new_df = initial_counties_df[constants.CENSUS_COUNTIES_COLUMNS]
new_df.rename(
new_df_copy = new_df.rename(
columns={"USPS": "State Abbreviation", "NAME": "County Name"},
inplace=True,
inplace=False
)
return new_df
return new_df_copy
def _transform_states(
self, initial_states_df: pd.DataFrame
@ -254,16 +257,16 @@ class PostScoreETL(ExtractTransformLoad):
pdf_path = constants.SCORE_DOWNLOADABLE_PDF_FILE_PATH
# Rename score column
downloadable_df.rename(
downloadable_df_copy = downloadable_df.rename(
columns={"Score G (communities)": "Community of focus (v0.1)"},
inplace=True,
inplace=False,
)
logger.info("Writing downloadable csv")
downloadable_df.to_csv(csv_path, index=False)
downloadable_df_copy.to_csv(csv_path, index=False)
logger.info("Writing downloadable excel")
downloadable_df.to_excel(excel_path, index=False)
downloadable_df_copy.to_excel(excel_path, index=False)
logger.info("Compressing files")
files_to_compress = [csv_path, excel_path, pdf_path]

View file

@ -407,12 +407,7 @@
" method_name=\"Persistent Poverty (CBG)\",\n",
" priority_communities_field=PERSISTENT_POVERTY_CBG_LEVEL_FIELD,\n",
" other_census_tract_fields_to_keep=[],\n",
" ),\n",
" Index(\n",
" method_name=FEMA_COMMUNITIES,\n",
" priority_communities_field=FEMA_COMMUNITIES,\n",
" other_census_tract_fields_to_keep=[],\n",
" ),\n",
" )\n",
" ]\n",
")\n",
"\n",
@ -1726,7 +1721,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.7.4"
}
},
"nbformat": 4,