Skip to content

Commit eb014fa

Browse files
authored
fix: skip student loan uprating if column doesn't exist (#1500)
During initial dataset creation in policyengine-uk-data, the student_loan_plan column is added by imputation after the base FRS dataset is created. The uprating code runs before imputation, so we need to gracefully skip if the column doesn't exist yet.
1 parent 708dff8 commit eb014fa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

policyengine_uk/data/economic_assumptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ def uprate_student_loan_plans(
245245
For (2) and (3), we use highest_education == TERTIARY as the signal
246246
for who is a graduate, then apply a flat take-up probability.
247247
"""
248+
# Skip if student_loan_plan column doesn't exist yet (e.g., during
249+
# initial dataset creation before imputation runs)
250+
if "student_loan_plan" not in current_year.person.columns:
251+
return current_year
252+
248253
year = int(current_year.time_period)
249254

250255
person = current_year.person.copy()

0 commit comments

Comments
 (0)