Skip to content

Commit d2d6c09

Browse files
MaxGhenisclaude
andauthored
Fix SOI uprating dtype error (#602)
* Fix SOI dtype error and ensure non-negative retirement/SS values 1. soi.py: Cast SOI "Value" column to float before uprating multiplication, fixing TypeError on newer pandas that reject float-into-int64 assignment. 2. extended_cps.py: Add defensive np.maximum(pred_values, 0) clip in _splice_cps_only_predictions for retirement contribution and SS sub-component variables, preventing negative values from surviving entity-level aggregation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove defensive clip — apply_retirement_constraints already handles this Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dd3455a commit d2d6c09

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix SOI uprating dtype error on newer pandas and add defensive non-negativity clip for retirement/SS variables in splice step.

policyengine_us_data/utils/soi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def get_soi(year: int) -> pd.DataFrame:
164164
}
165165
soi = pd.read_csv(CALIBRATION_FOLDER / "soi_targets.csv")
166166
soi = soi[soi.Year == soi.Year.max()]
167+
soi["Value"] = soi["Value"].astype(float)
167168

168169
uprating_factors = {}
169170
for variable in uprating_map:

0 commit comments

Comments
 (0)