Skip to content

Commit 8f92037

Browse files
vahid-ahmadiclaude
andauthored
Fix np.is_in typo in cps.marriage_tax_reforms (#257) (#1637)
`np.is_in` is not a numpy function — the correct name is `np.isin`. Both call sites sit inside `if child_education_levels is not None:` branches, so the typo only surfaces when the reform is instantiated with that argument. Replace with `np.isin` so the reform doesn't crash with AttributeError when exercised. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent eb76457 commit 8f92037

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

changelog.d/257.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix `AttributeError` in `cps.marriage_tax_reforms` when reform was instantiated with `child_education_levels` — replace nonexistent `np.is_in` (typo) with `np.isin`.

policyengine_uk/reforms/cps/marriage_tax_reforms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def formula(person, period):
1919
child_meets_age_condition = person("age", period) <= max_child_age
2020
return benunit.any(child_meets_age_condition)
2121
if child_education_levels is not None:
22-
child_meets_education_condition = np.is_in(
22+
child_meets_education_condition = np.isin(
2323
person("education_level", period).decode_to_str(),
2424
child_education_levels,
2525
)
@@ -110,7 +110,7 @@ def formula(person, period):
110110
child_meets_age_condition = person("age", period) <= max_child_age
111111
return benunit.any(child_meets_age_condition)
112112
if child_education_levels is not None:
113-
child_meets_education_condition = np.is_in(
113+
child_meets_education_condition = np.isin(
114114
person("education_level", period).decode_to_str(),
115115
child_education_levels,
116116
)

0 commit comments

Comments
 (0)