CodeSampleX

サンプル

polars 1.43.2: Port pandas DataFrame code to polars on Alpine, without the wheel surprise or the silently wrong answers

検証済みサンプル — pypi polars 1.43.2: Port pandas DataFrame code to polars on Alpine, without the wheel surprise or the silently wrong answers. python 3.12 · linux…

sha256:a238e626062c628c548646e46144b6aac21a07492cf10e1617eb4286c853ac05

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 python 3.12 linux · musl x64 python 3.12 python pip

検証実行環境

環境 コントラクト ステージ 実行日
python 3.12 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · pypi@1
2026-08-14
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · pypi@1
2026-08-18

ケース

MIGRATION
ゴール
Port pandas DataFrame code to polars on Alpine, without the wheel surprise or the silently wrong answers
パッケージ
シンボル
  • polars.DataFrame
  • polars.LazyFrame
  • polars.col
  • polars.len
  • DataFrame.filter
  • DataFrame.select
  • DataFrame.with_columns
  • DataFrame.with_row_index
  • DataFrame.group_by
  • GroupBy.agg
  • LazyFrame.collect
  • LazyFrame.explain
  • LazyFrame.collect_schema
  • Expr.map_elements
  • Expr.alias
  • Series.is_null
  • Series.is_nan
  • Series.fill_null
  • Series.fill_nan
  • Series.eq_missing
  • polars.exceptions.ColumnNotFoundError
  • polars.exceptions.DuplicateError
  • polars.exceptions.PerformanceWarning
  • DataFrame.vstack
  • DataFrame.hstack
  • DataFrame.extend
  • DataFrame.insert_column
  • DataFrame.drop_in_place
環境
python 3.12
作成日
2026-08-14T12:56:07Z

コントラクト

  1. assert pip took the musllinux wheel for the engine, polars_runtime_32-1.43.2-cp310-abi3-musllinux_1_2_x86_64.whl, reconstructed from the recorded dist-info tag
  2. assert polars itself is a pure-Python py3-none-any distribution carrying no compiled file, which depends on polars-runtime-32==1.43.2 for the engine
  3. assert the engine's shared object is named .abi3.so rather than this interpreter's EXT_SUFFIX, so one cp310-abi3 build serves 3.12
  4. assert the interpreter reports musl and polars.__version__ agrees with the distribution metadata, which is the check a half-installed polars fails
  5. assert a DataFrame has none of index, loc, iloc, at, iat, values, reset_index, sort_values, assign, query or apply
  6. assert filtering renumbers rows from zero, and with_row_index before the filter is what carries the original positions through, as UInt32 data
  7. assert brackets take a column by name and a row by position, and an unknown name raises ColumnNotFoundError
  8. assert a boolean mask in brackets selects columns rather than rows, raising ValueError when its length does not match the column count
  9. assert the same mask on a frame with as many columns as rows returns the wrong columns with no error at all
  10. assert filter with a pl.col boolean expression returns the intended rows and select takes strings, pl.col and an anchored regex
  11. assert an Expr has no truth value, so `and` and `or` both raise TypeError, and dropping the parentheses around & raises that identical message
  12. assert separate positional predicates mean AND, and the keyword form is equality against a literal
  13. assert with_columns returns a new frame, leaves the input's columns and values untouched, and has no inplace parameter
  14. assert item assignment on a DataFrame raises TypeError naming DataFrame.with_columns as the replacement
  15. assert the new frame shares the untouched column's Arrow allocation with the old one, so returning a frame copies the column list rather than the data
  16. assert polars does keep a mutating escape hatch: hstack and vstack take in_place= and hand the same object back, and extend, insert_column and drop_in_place mutate the receiver
  17. assert an unaliased expression is named after the first column it mentions, so with_columns replaces that column instead of adding one
  18. assert explain returns the plan as a string while the per-row Python hook has still not been called once
  19. assert the optimizer moves the filter below the projection, the reverse of both the unoptimized plan and the order written
  20. assert collect runs the hook on only the two surviving rows, where the identical eager pipeline runs it on all six
  21. assert a LazyFrame naming a missing column is built without complaint and raises ColumnNotFoundError only when the plan is resolved, which explain also does
  22. assert a LazyFrame has no shape, and asking it for columns emits a PerformanceWarning because that resolves the schema
  23. assert is_null and is_nan disagree on every hole, and is_nan over a null is null rather than False
  24. assert null_count reports one null while the mean is nan, count excludes the null and pl.len counts every row
  25. assert a column holding a NaN and no null reports null_count zero with a nan mean, so a missing-data check written as null_count() == 0 passes on it
  26. assert min and max ignore the NaN that sum and mean propagate
  27. assert comparison against a null yields null while eq_missing yields False
  28. assert polars orders NaN above every number and compares it equal to itself, the opposite of Python, so a > 0 filter keeps the NaN and drops the null
  29. assert nulls sort first in both directions unless nulls_last is set
  30. assert drop_nulls keeps NaN and drop_nans keeps null, neither fill touches the other's hole, and fill_nan(None) collapses the two into one
  31. assert an integer column with a missing value stays Int64 and its aggregates skip the null on both sides of the division
  32. assert group_by returns the group keys first, then one column per agg expression in the order given
  33. assert maintain_order gives first-appearance order, which is not sorted order, and without it only the set of rows is defined
  34. assert two aggregates over one column collide as DuplicateError, worded one way inside agg and another inside select

ファイル

  • csx.json
  • requirements.txt
  • src/__init__.py
  • src/frames.py
  • src/install.py
  • test/contract.py

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

anonymous