Issue 1992: Do not impute income for null population tracts (#1993)

This commit is contained in:
Lucas Merrill Brown 2022-10-07 11:28:11 -04:00 committed by GitHub
commit e2641fe2a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,10 +76,10 @@ def _prepare_dataframe_for_imputation(
# First, check whether any of the columns we want to impute contain null # First, check whether any of the columns we want to impute contain null
# values # values
geo_df[imputing_cols].isna().any(axis=1) geo_df[imputing_cols].isna().any(axis=1)
# Second, ensure population is either null or >= the minimum population # Second, ensure population is not null and >= the minimum population
& ( & (
geo_df[population_field].isnull() geo_df[population_field].notnull()
| ( & (
geo_df[population_field] geo_df[population_field]
>= minimum_population_required_for_imputation >= minimum_population_required_for_imputation
) )