示例
pandas 3.0.5: merge, array, NA
已验证示例 — pypi pandas 3.0.5: merge, array, NA. contract 在 python 3.14 · linux alpine/x64 · docker 上运行并通过: An outer top-level pandas.merge matches one missing…
sha256:9497731711d6252100a5bf41c3ade2e4f710509e602c1db3f7ad78e8cea5d97d
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 2
- 构建过它的签名密钥
- 2
声明的环境
python 3.14 linux · musl x64 python 3.14 python 3.14 pip
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| python 3.14 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1 |
2026-08-19 |
| python 3.14 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.14-alpine@sha256:05b2b8b732ec… |
2026-09-08 |
案例
HOW- 目标
- verify pandas.merge in pkg:pypi/pandas@3.0.5
- 符号
-
- pandas.merge
- pandas.array
- pandas.NA
- pandas.errors.MergeError
- 环境
- python 3.14
- 创建时间
- 2026-08-18T13:40:54Z
契约
- An outer top-level pandas.merge matches one missing Int64 key across both sides and reports three both, two left_only, and one right_only rows.
- validate='one_to_one' raises pandas.errors.MergeError when an ordinary left join key is duplicated.
- left_anti returns only keys 1 and 4 while right_anti returns only key 2, excluding the missing key because pandas treats it as matched.
文件
- PROMPT.md
- csx.json
- requirements.lock
- requirements.txt
- spec.json
- test/contract.py
源代码
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pandas.merge in pkg:pypi/pandas@3.0.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/pandas@3.0.5
Demonstrate these symbols/APIs:
- pandas.merge
Required runtime conditions:
- ecosystem: golang
- language: go
- packageManager: go@1.26.5
- runtime: go@1.26.5
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:c01f2fb6a51dd5b611b5297b13e5cd2a1c64dd92976c09e3b133b37d990387ae","contract":["An outer top-level pandas.merge matches one missing Int64 key across both sides and reports three both, two left_only, and one right_only rows.","validate='one_to_one' raises pandas.errors.MergeError when an ordinary left join key is duplicated.","left_anti returns only keys 1 and 4 while right_anti returns only key 2, excluding the missing key because pandas treats it as matched."],"goal":"verify pandas.merge in pkg:pypi/pandas@3.0.5","kind":"HOW","packages":["pkg:pypi/pandas@3.0.5"],"schemaVersion":1,"symbols":["pandas.merge","pandas.array","pandas.NA","pandas.errors.MergeError"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","ecosystem":"pypi","executionContext":"python","language":"python","languageVersion":"3.14","libc":"musl","os":"linux","packageManager":"pip","runtime":"python","runtimeVersion":"3.14","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/pandas@3.0.5"],"schemaVersion":1,"symbols":["pandas.merge","pandas.array","pandas.NA","pandas.errors.MergeError"],"verifierAdapter":"python@1"}
numpy==2.5.2
pandas==3.0.5
python-dateutil==2.9.0.post0
six==1.17.0
numpy==2.5.2
pandas==3.0.5
python-dateutil==2.9.0.post0
six==1.17.0
{
"schemaVersion": 1,
"goal": "verify pandas.merge in pkg:pypi/pandas@3.0.5",
"kind": "HOW",
"packages": [
"pkg:pypi/pandas@3.0.5"
],
"symbols": [
"pandas.merge"
],
"runtimeConditions": {
"ecosystem": "golang",
"language": "go",
"packageManager": "go@1.26.5",
"runtime": "go@1.26.5"
}
}
import pandas as pd
def assert_merge_error(callback) -> None:
try:
callback()
except pd.errors.MergeError:
return
raise AssertionError("expected pandas.errors.MergeError")
def make_frames() -> tuple[pd.DataFrame, pd.DataFrame]:
left = pd.DataFrame(
{
"key": pd.array([1, None, 3, 3, 4], dtype="Int64"),
"left_value": ["one", "missing", "three-a", "three-b", "four"],
}
)
right = pd.DataFrame(
{
"key": pd.array([None, 2, 3], dtype="Int64"),
"right_value": ["missing", "two", "three"],
}
)
return left, right
def test_outer_merge_and_validation() -> None:
left, right = make_frames()
merged = pd.merge(
left,
right,
on="key",
how="outer",
indicator=True,
validate="many_to_many",
)
counts = merged["_merge"].astype("string").value_counts().to_dict()
assert counts == {"both": 3, "left_only": 2, "right_only": 1}, counts
missing = merged.loc[merged["key"].isna()]
assert len(missing) == 1
assert missing.iloc[0]["left_value"] == "missing"
assert missing.iloc[0]["right_value"] == "missing"
assert missing.iloc[0]["_merge"] == "both"
assert_merge_error(
lambda: pd.merge(left, right, on="key", validate="one_to_one")
)
def test_anti_joins_treat_missing_keys_as_matches() -> None:
left, right = make_frames()
left_unique = left.drop_duplicates("key", keep="first")
left_anti = pd.merge(left_unique, right, on="key", how="left_anti")
right_anti = pd.merge(left_unique, right, on="key", how="right_anti")
assert sorted(left_anti["key"].astype("int64").tolist()) == [1, 4]
assert right_anti["key"].astype("int64").tolist() == [2]
assert not left_anti["key"].isna().any()
assert not right_anti["key"].isna().any()
if __name__ == "__main__":
test_outer_merge_and_validation()
test_anti_joins_treat_missing_keys_as_matches()
print("pandas 3.0.5 top-level merge contract passed")
原始种子者
匿名