Skip to main content

DataComPy

PyPI - Python Version Ruff PyPI version Anaconda-Server Badge PyPI - Downloads

DataComPy is a package to compare two DataFrames (or tables) such as Pandas, Spark, Polars, and even Snowflake. Originally it was created to be something of a replacement for SAS's PROC COMPARE for Pandas DataFrames with some more functionality than just Pandas.DataFrame.equals(Pandas.DataFrame) (in that it prints out some stats, and lets you tweak how accurate matches have to be). Supported types include:

  • Pandas
  • Polars
  • Spark (classic and Spark Connect)
  • Snowflake

Quick Installation

pip install datacompy

or

conda install datacompy

Installing extras

If you would like to use Spark or any other backends please make sure you install via extras:

pip install datacompy[spark]
pip install datacompy[snowflake]

Supported backends

Command Line Interface

DataComPy ships a datacompy command, so ad hoc checks and CI pipelines do not need a throw-away script (see documentation):

# Compare two files and print a report
datacompy compare --left before.csv --right after.csv --on id

# Fail a build on any difference, with a JSON report saved as an artifact
datacompy compare \
    --left before.parquet --right after.parquet \
    --on account_id,as_of_date \
    --abs-tol balance=0.01 \
    --max-unequal-rows 0 \
    --report-format json --output reports/diff.json --quiet

It exits 0 when the datasets match, 1 when they differ, and 2 on error. CSV, Parquet, and JSON inputs are supported on the pandas, polars, and Spark backends, including tab separated CSV via a .tsv extension, and Snowflake tables can be compared in place.

Programmatic Report Access

Every compare object exposes build_report_data() which returns a typed ReportData object — useful for dashboards, JSON export, or custom rendering without relying on the string report:

import pandas as pd
from datacompy import PandasCompare

df1 = pd.DataFrame({"id": [1, 2, 3], "val": [10, 20, 30]})
df2 = pd.DataFrame({"id": [1, 2, 3], "val": [10, 99, 30]})

compare = PandasCompare(df1, df2, join_columns="id")

# Access structured data directly
data = compare.build_report_data()
print(data.row_summary.unequal_rows)  # 1
print(data.mismatch_stats.stats[0].column)  # 'val'

# Render / export — methods live on ReportData itself
print(data.render())  # same text as compare.report()
data.save("report.html")  # HTML file
data.to_dict()  # JSON-serializable dict

See the Report API documentation for the full reference.

Contributors

We welcome and appreciate your contributions! Before we can accept any contributions, we ask that you please be sure to sign the Contributor License Agreement (CLA).

To run the CI test matrix locally, including the Spark and Spark Connect tracks without a hand-managed JDK, see the Developer Instructions.

This project adheres to the Open Source Code of Conduct. By participating, you are expected to honor this code.

Metadata

Release files for datacompy 1.2.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 datacompy 1.2.0
File Size Uploaded Provenance Actions
datacompy-1.2.0.tar.gz 153.7 kB With provenance Details for datacompy-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 256.0 kB

Release files / datacompy-1.2.0.tar.gz

Download URL datacompy-1.2.0.tar.gz
Size 153.7 kB
Tags Source
SHA-256 checksum
How to use checksums
62d2bdc18b2b889d25a4f28f9b7dde850c59e9fc1deec3c49a7facd859b8eb6e
BLAKE2b-256 checksum
How to use checksums
200188879fda3c32421885e9bc112147539f4c1547b50c0374bbaf85c157309c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / datacompy-1.2.0-py3-none-any.whl

Download URL datacompy-1.2.0-py3-none-any.whl
Size 102.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7775271f351a1c7b6ac112ca8887fefda17cbbef3bc47cd92d1d46c54a817062
BLAKE2b-256 checksum
How to use checksums
5260b8e9cad5a3a697e9acf666769f83592e0871756eec83f198fcea7f7d8e37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for datacompy 1.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for datacompy-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files Full provenance

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