Validation result is sometimes incorrect when using group rules
@borchero 已经在做这个了。
开始于 2026年2月17日。
评估
这个 Issue 还没有评估数据。
描述
In yesterday's PyData meetup in Zurich, one question prompted me to realize that we're incorrectly dealing with group rules and row-level rules: if a row-level rule removes a row which would make a group rule fail, we do not realize it. For example:
import dataframely as dy
import polars as pl
class DiagnosisSchema(dy.Schema):
invoice_id = dy.String(primary_key=True)
diagnosis = dy.String(primary_key=True, regex="^[A-Z]{3}$")
is_main = dy.Bool(nullable=False)
@dy.rule()
def exactly_one_main_diagnosis() -> pl.Expr:
return pl.col("is_main").sum() == 1
df = pl.DataFrame(
{
"invoice_id": ["A", "A", "A"],
"diagnosis": ["ABC", "ABD", "123"],
"is_main": [False, False, True],
}
)
good, _ = DiagnosisSchema.filter(df)
print(good)
results in
shape: (2, 3)
┌────────────┬───────────┬─────────┐
│ invoice_id ┆ diagnosis ┆ is_main │
│ --- ┆ --- ┆ --- │
│ str ┆ str ┆ bool │
╞════════════╪═══════════╪═════════╡
│ A ┆ ABC ┆ false │
│ A ┆ ABD ┆ false │
└────────────┴───────────┴─────────┘
which clearly violates the schema since we don't have a main diagnosis for the group.
- 主要语言
- Python
- 星标
- 618
- 派生
- 21
- 平均合并
- 14 小时 34 分钟
- 30 天内合并 PR
- 7
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Quantco/dataframely 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
Quantco/dataframely#402 · 3 条评论 ·
-
难度 3/5 1-2 天 新手友好度 62/100
Quantco/dataframely#357 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
Quantco/dataframely#309 · 4 条评论 · 2 个 reaction ·
-
难度 5/5 一周以上 新手友好度 45/100
Quantco/dataframely#295 · 3 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 45/100
Quantco/dataframely#273 · 5 条评论 · 1 个 reaction ·
查看 Quantco/dataframely 的全部 Issue
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100