Skip to main content

EquiFrame: semantic comparison and dataframe migration

EquiFrame 0.15.7 Beta includes a pretrained SERCOP Isolation Forest and a review flow that can check captured results in R. Version 0.15.7 handbook · First ETL check · Documentation by version 0.14.0 errata

Documentation | API | Examples | 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.15.7 supports Python 3.10, 3.11, 3.12 and 3.13.

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

The base installation is python -m pip install equiframe==0.15.7. 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.

Quick start

Local file reading and comparison need no EquiFrame account or API key. Install the extra for the engine you use. To validate a captured SERCOP run, pass its run.json, the independent Arrow reference and the reference binding to equiframe sercop accept-execution.

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.

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.

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.15.7

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.15.7
File Size Uploaded Provenance Actions
equiframe-0.15.7.tar.gz 83.0 MB Without provenance Details for equiframe-0.15.7.tar.gz

Built distribution (wheel)

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

Total release size: 164.6 MB

Release files / equiframe-0.15.7.tar.gz

Download URL equiframe-0.15.7.tar.gz
Size 83.0 MB
Tags Source
SHA-256 checksum
How to use checksums
d23c819b8bc23c9c7d54ca142e437d4f4e82df3a09e16fc9a994676a335f9658
BLAKE2b-256 checksum
How to use checksums
b125f73b70a9a8d1e7e76dac556481ab24325b9ba10c0505c460f2757839c99b
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.15.7-py3-none-any.whl

Download URL equiframe-0.15.7-py3-none-any.whl
Size 81.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bf2b7173fd32612dd7a21908aa3911ad158e33b5a3f8c889209e400b50ec920f
BLAKE2b-256 checksum
How to use checksums
4606e8fa5724c032a1046f03f5ab68dc095d17eae8d8d83af2ef247683c09235
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.15.7

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