1295-college-attendance-field (#1297)

Lucas' work. Adding college attendance to tiles.
This commit is contained in:
Lucas Merrill Brown 2022-02-17 19:50:52 -05:00 committed by GitHub
commit 6e64134dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 7 deletions

View file

@ -375,6 +375,10 @@ SCORE_M_LOW_INCOME_SUFFIX = (
", is low income, and has a low percent of higher ed students"
)
COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD = (
"Percent higher ed enrollment rate is less than 20%"
)
# Climate Change
EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
f"Greater than or equal to the {PERCENTILE}th percentile"

View file

@ -92,6 +92,7 @@ class ScoreM(Score):
of booleans based on the condition of the FPL at 200%
is at or more than some established threshold
"""
return (
(
df[
@ -101,10 +102,7 @@ class ScoreM(Score):
>= self.LOW_INCOME_THRESHOLD
)
) & (
(
df[field_names.COLLEGE_ATTENDANCE_FIELD]
<= self.MAX_COLLEGE_ATTENDANCE_THRESHOLD
)
df[field_names.COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD]
| (
# If college attendance data is null for this tract, just rely on the
# poverty data
@ -732,6 +730,17 @@ class ScoreM(Score):
logger.info("Adding Score M")
self.df[field_names.THRESHOLD_COUNT] = 0
# TODO: move this inside of
# `_create_low_income_and_low_college_attendance_threshold`
# and change the return signature of that method.
# Create a standalone field that captures the college attendance boolean
# threshold.
self.df[field_names.COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD] = (
self.df[field_names.COLLEGE_ATTENDANCE_FIELD]
<= self.MAX_COLLEGE_ATTENDANCE_THRESHOLD
)
self.df[
field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES
] = self._create_low_income_and_low_college_attendance_threshold(