-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Description
Summary
When running with Python 3.14, the person() accessor method in Microsimulation contexts returns unweighted values instead of weighted values. This causes all tax calculations based on survey microdata to return incorrect (near-zero) values.
Reproduction
from policyengine_uk import Microsimulation
sim = Microsimulation()
# In Python 3.13: returns ~£86.7bn (weighted, correct)
# In Python 3.14: returns ~£0.11bn (unweighted, wrong)
print(sim.calculate("taxed_dividend_income", 2027).sum() / 1e9)Expected behavior
person() should return weighted values in Microsimulation contexts regardless of Python version.
Actual behavior
- Python 3.13:
person('taxed_dividend_income', '2027').sum()→ £86.7bn (correct) - Python 3.14:
person('taxed_dividend_income', '2027').sum()→ £0.11bn (wrong)
Impact
This breaks all microsimulation-based tax calculations. For example, dividend_income_tax returns £0 instead of ~£22bn when running with Python 3.14.
Individual Simulation objects work correctly in both Python versions - only Microsimulation with survey weights is affected.
Workaround
Pin Python 3.13 until this is fixed.
Environment
- Python 3.14 (tested with 3.14.0a6)
- policyengine-core (latest)
- policyengine-uk (latest)
Metadata
Metadata
Assignees
Labels
No labels