Skip to main content

EquiFrame: semantic comparison and dataframe migration

EquiFrame 0.16.0 Beta SERCOP excludes missing amounts from grouped sums. The CI example checks the final decision. Install EquiFrame and the optional, exactly paired equiframe-benchmark. Release notes and SHA-256 hashes identify the files for this version. See the release procedure.

TestPyPI records. EquiFrame · Benchmark

0.16.0 documentation | 0.16.0 API | Documentation by version | Issues

EquiFrame checks whether tabular data and supported transformations preserve their meaning when moving between Pandas, Polars and DuckDB. It reads files, creates native dataframe objects, converts between engines and reports semantic differences under explicit comparison policies.

Use it to check a dataframe refactor, validate an ETL result or add migration checks to an existing application. Contracts describe keys, types, numeric precision, missing values, duplicates, order and dates. The library works with your own data, independently of procurement schemas, warehouses and cloud services.

The distribution is classified Beta. Existing stable APIs and persisted formats retain their compatibility commitments; experimental workflows remain explicitly identified. See the readiness review.

Install

EquiFrame 0.16.0 supports Python 3.10, 3.11, 3.12 and 3.13.

python -m pip install "equiframe[files,engines,ml]==0.16.0"
python -m pip check

The base installation is python -m pip install equiframe==0.16.0. It includes Arrow and the pretrained SERCOP Isolation Forest. Discrepancies can be reviewed offline with the bundled R runtime on Windows and Linux x64. SERCOP guide. Optional engines and machine-learning libraries are loaded when requested. Run equiframe sercop model to validate the bundled detector and equiframe sercop score with a compatible profile to obtain its score. The base install brings Arrow and includes the R runtime for offline SERCOP discrepancy review on Windows and Linux x64. SERCOP model and ETL review

Extra Purpose
files JSON, JSONL, CSV, delimited TXT, XML, Excel, Parquet and GeoJSON readers
pandas, polars, duckdb The selected engine and Arrow transport
engines Pandas, Polars, DuckDB and Arrow
ml Isolation Forest with scikit-learn and NumPy
eda, eda-charts Experimental exploratory analysis and optional charts

The standalone review_with_r API accepts an existing Rscript executable. See dependencies and supported ranges.

Use equiframe sercop accept-execution to check a completed run.json with an independent Arrow reference and its binding. The report identifies failed input or output constraints and retains the comparison, Isolation Forest and R findings.

Architect demo

Install the DuckDB extra before running the demo. Choose a new output directory for each run.

python -m pip install "equiframe[duckdb]==0.16.0"
python -I -m equiframe doctor --extra duckdb
python -I -m equiframe demo --role architect --output sql-good

Use the hybrid ETL assessment to assess declared outputs with a contract, a pretrained volume forest and an independent R comparison.

Quick start

Beta 0.15.8 includes verify accept. The ETL quickstart generates a sample CSV, its reference binding and the requests for three CI outcomes. The checks return 0 for acceptance, 1 for a difference and 3 for unavailable evidence.

Local file reading and comparison need no EquiFrame account or API key. Install the extra for the engine you use. The SERCOP command can run the included R reviewer offline on Windows and Linux x64 with glibc.

Read a file and choose its destination

With the files and engines extras installed, provide an existing file:

import equiframe as ef

with ef.load_dataset("orders.json") as loaded:
    print(loaded.info.to_dict())
    pandas_df = loaded.pandas

    with ef.convert_dataset(loaded, target="polars") as converted:
        polars_df = converted.frame

    with ef.convert_dataset(loaded, target="duckdb") as converted:
        relation = converted.frame
        print(relation.limit(5).df())

EquiFrame reports columns, detected types and row count. The initial load constructs Pandas; target selects the native object exposed as loaded.frame. Later conversions consume the selected native frame and record its provenance. Keep the context open while using an owned DuckDB relation.

Select a destination directly:

import equiframe as ef

with ef.load_dataset("orders.parquet", target="polars") as loaded:
    polars_df = loaded.frame

Pass DatasetReadOptions for multiple Excel sheets, nested JSON/XML, ambiguous delimiters or exact column representations. The file-reading guide describes supported forms, preserved representations and resource limits.

equiframe dataset load orders.json
equiframe dataset load orders.json --target polars
equiframe dataset inspect orders.parquet

The first command asks for a destination in an interactive terminal. Supply --target in automated jobs. Invalid inputs return a nonzero exit and an error on stderr.

Migrate your own data across engines

EquiFrame supports all six directions among Pandas, Polars and DuckDB. For example, select Polars when loading invoices and convert the resulting native frame to a DuckDB relation.

import equiframe as ef

with ef.load_dataset("invoices.parquet", target="polars") as source:
    with ef.convert_dataset(source, target="duckdb") as result:
        print(result.frame.limit(5).df())

For ETL, declare the source engine, target engine, contract and a supported relational plan. Use ef.migrate or equiframe migration run to execute it, compare the two outputs and check an independent reference. The packaged SERCOP detector has its own profile. The conversion and native ETL APIs work with other domains using their own contracts. Native ETL · Examples

Compare independently produced results

This example deliberately changes one amount:

from pathlib import Path

import pandas as pd
import polars as pl

import equiframe as ef

original = pd.DataFrame({"id": [1, 2], "amount": [100, 200]})
migrated = pl.DataFrame({"id": [1, 2], "amount": [100, 201]})

result = ef.diff(original, migrated, keys=["id"], work_dir=Path("equiframe-runs"))
print(result.state)  # different
print(result.complete)

Inspect differences with ef.iter_differences(result.differences). Enforce acceptance with ef.assert_equivalent(result); divergent or incomplete results raise ef.EquivalenceAssertionError. Operational failures use the ef.EquiFrameError hierarchy, including DatasetReadError, MissingDependencyError and InvalidExecutionInput. See the API reference for argument-validation exceptions and command-specific exits.

All six directed combinations of Pandas, Polars and DuckDB are supported. A verdict concerns the supplied inputs and contract. Preserve complete and unavailable-component states when deciding whether to accept a migration.

Compare amounts by arbitrary groups

New in 0.13.1, compare exact sums for any grouping columns and numeric measure:

import pyarrow as pa
import equiframe as ef

expected = pa.table(
    {
        "branch": ["A", "A", "B", "C", "D"],
        "currency": ["USD"] * 5,
        "sales": [40, 60, 0, 50, 9],
    }
)
candidate = pa.table(
    {
        "branch": ["A", "A", "B", "C", "E"],
        "currency": ["USD"] * 5,
        "sales": [90, 60, 25, 50, 7],
    }
)
summary = ef.compare_grouped(
    candidate,
    expected,
    by=("branch", "currency"),
    column="sales",
)
print(summary.modified_group_proportion)
print(summary.maximum_relative_difference)
print(summary.changed_from_zero_groups)
print(summary.group_coverage, summary.comparison_coverage)

The same API works for inventory by warehouse, expenses by department or amounts by entity and currency. It reports missing and invalid groups explicitly; an empty denominator is None. Metrics use exact Fractions and do not change the existing row-equivalence checks. See the grouped-comparison guide for formulas, tolerances, zero references, input types and bounded examples.

ETL, rules, anomalies and R review

  • Data conversion: load_dataset and convert_dataset move loaded data between native objects.
  • Transformation migration: check_migration and migrate validate and run supported declarative plans: projections, filters, joins, aggregations, windows and ordering. Each engine executes its own native plan.
  • Semantic checks: policies cover values, types, decimals, missing values, keys, multiplicity, order and time semantics.
  • Anomaly detection: rules, Isolation Forest and MAD keep separate results. Fitting, calibration and inference are explicit operations.
  • Independent R review: review_with_r, finalize_with_r and finalize_execution_with_r use a real R process and an explicit contract, preserving earlier alerts, disagreements and unavailable components.

See entry points, semantics, migration and R review. Registered callbacks and SQL are trusted application code; EquiFrame does not sandbox untrusted programs.

See the standalone detection benchmark for measured detection, false alarms and component API costs on generated cases, including missed errors and correct changes of workload. The executed Isolation Forest notebook shows training, calibration, false alarms and missed faults. The 0.14.0 evaluation receipt and 0.15.0 temporal evaluation identify their respective wheels. The inference timings describe the synthetic 200-tree experiment.

Run a complete example

The source distribution includes examples/load_convert_compare.py. It creates temporary synthetic orders, loads Pandas, converts to Polars and DuckDB, checks equivalence and verifies a deliberate one-row regression. Its files are removed when finished:

python examples/load_convert_compare.py --rows 30000

Installed wheels provide the same example as python -m equiframe.examples.load_convert_compare --rows 30000. Further examples and recipes cover ETL, reconciliation and terminal usage.

Compatibility and development

The compatibility register distinguishes stable interfaces and experimental capabilities. Advanced orchestration, standalone pipelines, EDA and reduction remain experimental. The separate equiframe-benchmark distribution remains Beta.

Releases use MAJOR.MINOR.PATCH: patches preserve documented contracts, minor releases add compatible functionality, and breaking changes require migration notes. During 0.x, consult the upgrade guide and changelog. Release versions derive from reviewed Git tags.

The source distribution includes src/, py.typed, examples, tests, schemas and release tools. Development uses Ruff for linting and formatting, mypy in strict mode, and source and installed-distribution tests. The contribution guide provides commands and dependency locks.

Support and license

Use the issue tracker for reproducible bugs. Include package, Python and engine versions, operating system, expected results and a shareable example. Sensitive reports belong in the private security channel.

Hernán Troya (htroya) maintains releases and security handling without a fixed response-time SLA. The reusable library and its scientific benchmark have separate acceptance criteria.

Original code is licensed under MIT. Bundled CycloneDX schemas retain Apache-2.0. See third-party notices and license scope.

Metadata

Release files for equiframe 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for equiframe 0.16.0
File Size Uploaded Provenance Actions
equiframe-0.16.0.tar.gz 83.1 MB Without provenance Details for equiframe-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for equiframe 0.16.0
File Interpreter ABI Platform Actions
equiframe-0.16.0-py3-none-any.whl Python 3 none any Details for equiframe-0.16.0-py3-none-any.whl

Total release size: 164.8 MB

Release files / equiframe-0.16.0.tar.gz

Download URL equiframe-0.16.0.tar.gz
Size 83.1 MB
Tags Source
SHA-256 checksum
How to use checksums
87ef396c371efdced2cc8bcba2c83531284ef0e4744fb278aa8ad491da324f4c
BLAKE2b-256 checksum
How to use checksums
14239a529347dde612b4a85fca859cf88c7d49ea1597d7acc7fac029fb861615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.18

Release files / equiframe-0.16.0-py3-none-any.whl

Download URL equiframe-0.16.0-py3-none-any.whl
Size 81.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2cac349084aa3b71020072ac47adf1217a9841ccd02d372f932ec1df9884a608
BLAKE2b-256 checksum
How to use checksums
49c08f9cd572e5c5c86c3e414c2b97b1ff73470ff8a6595ff53c3c8497b67a18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.18

Security for equiframe 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page