The donor reader reads a blank household cost as zero before validation
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 concept_mapping.py:2728-2734(提交 9505a0da1c)中 AllocateToReferencePerson 的逆向函数开始,即转换为 float64、按住户求和并用 0 填充的三行代码。然后阅读调用方 read_populace_us_donor 以及 transport.py:868-876 的校验代码块,这是该解码唯一被使用的地方,0 在这里绕过了空值、非有限值和范围检查。完成标准是:在求和之前拒绝空的、非有限的或非实数的源值,每种情况各有一个测试;复用 issue 中的探针来确认这两种情况。
由索引模型根据 Issue 内容生成。
描述
read_populace_us_donor decodes three household costs from person columns: rent from pre_subsidy_rent, mortgage interest from home_mortgage_interest and property tax from real_estate_taxes. Each binding uses AllocateToReferencePerson, and its inverse (concept_mapping.py:2728-2734 at 9505a0da1c) casts the person column to float64, sums it by household and fills a household with no persons with 0.
pandas skips blanks in that sum. A household whose persons all hold a blank cost reads 0, and a blank beside a value reads as that value. The cast also drops the imaginary part of a complex value, with a ComplexWarning and no error.
The reader validates the decoded tables next (transport.py:876). Its checks for nulls, non-finite values and bounds would refuse a blank cost, but they receive 0, so the reader accepts the donor. Only the reader calls this decode (transport.py:868).
A probe with the inverse's three lines shows both cases:
invert(pd.Series([np.nan, 5.0, np.nan]), person_household=[1, 1, 2], households=[1, 2, 3])
# array([5., 0., 0.])
invert(pd.Series([7 + 99j, 1 + 0j]), person_household=[1, 2], households=[1, 2])
# array([7., 1.]), with a ComplexWarning
I have not checked whether any donor file in use holds a blank in these columns.
A fix could refuse a blank, non-finite or non-real value in the source column before the sum, with one test per case. The check of #1698 found this; #1698 leaves decode unchanged, and its profiled read and the plain read decode these costs the same way.
- 主要语言
- Python
- 星标
- 0
- 派生
- 6
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 190
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PolicyEngine/microcosm 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 79/100
PolicyEngine/microcosm#1766 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
PolicyEngine/microcosm#1721 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
PolicyEngine/microcosm#1638 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
PolicyEngine/microcosm#1431 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
PolicyEngine/microcosm#1220 ·
维护者通常 1 天内回复
查看 PolicyEngine/microcosm 的全部 Issue
相似的 Issue
-
claude-subscription-directsdk: tool calls with raw control characters in string values are dropped未关闭
难度 2/5 1-3 小时 新手友好度 72/100
NousResearch/hermes-official-plugins#538 ·
维护者通常 3 天内回复
-
bug(qdiffusion): EnergyModel.score_visible_logits computes biased visible/hidden on-ratios when solver returns variable solution counts per candidate可能已有人在做 @houzhongyu 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
qboson/kaiwu-pytorch-plugin#2133 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
MakazhanAlpamys/Soup#3415 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复