datacompy
Dataframe comparisons in Python
What it is and what it does
DataComPy is a DataFrame comparison tool that goes beyond simple equality checks by identifying and reporting row and column differences across Pandas, Polars, Spark, and Snowflake tables. It was originally designed as a Python equivalent to SAS's PROC COMPARE, offering structured output that can be rendered as text reports, HTML files, or JSON-serializable dictionaries for programmatic use.
The package accepts two DataFrames, specifies join columns for row matching, and produces detailed statistics on mismatches. It exposes a ReportData API that lets you access comparison results programmatically without relying on string parsing, making it suitable for dashboards, automated validation pipelines, and data quality checks. Version 1.0.4 is the current stable release; the v0.19.x line is no longer supported.
Use it for:
- Validate that ETL transformations produce expected output by comparing input and output DataFrames.
- Detect data drift or corruption by comparing snapshots of production tables at different points in time.
- Automate regression testing for data pipelines by comparing test results against baseline DataFrames.
- Generate audit reports showing which rows and columns differ between two database exports or Snowflake tables.
- Build data quality dashboards that consume structured comparison results via the ReportData API.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
DataComPy compares two DataFrames across Pandas, Polars, Spark, and Snowflake, reporting differences in rows and columns with configurable matching tolerance and structured output for programmatic access.
Yes. DataComPy is actively maintained, has no known vulnerabilities, low install friction, and solves a concrete problem for data engineers and QA teams. The permissive Apache license and support for multiple backends (Pandas, Polars, Spark, Snowflake) make it a practical choice for DataFrame validation and comparison workflows. Install it if you need to compare tabular data programmatically or generate detailed difference reports.
Install
datacompy on PyPI
pip
pip install datacompyuv
uv add datacompypoetry
poetry add datacompyInstalling datacompy
Before you install
Low install friction with a pure-wheel distribution. Active maintenance with a recent release (15 days ago) and ongoing commits. Runtime dependencies are well-established data libraries (pandas, polars, numpy, jinja2, ordered-set); optional extras for Spark and Snowflake are available but not required for core use.
License in practice
Apache Software License (permissive) places no significant restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install datacompy
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")
print(compare.report())
Requires Python 3.10 or later.
Verify before relying
- Whether tolerance/matching configuration options are documented and how granular they are.
- Performance characteristics when comparing very large DataFrames across backends.
- Whether Spark and Snowflake backends require additional system dependencies beyond pip extras.
Package facts
| License | Apache Software License (permissive) |
| Python support | supports the current Python release (>=3.10.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — jinja2, numpy, ordered-set, pandas, polars |
| Maintenance | actively maintained — 15 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,874,187/month — #2,469 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: datacompy-1.0.4-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
pyspark-testProvides a testing utility to assert equality…
permissive · top 15,000 on PyPI
dataframe-api-compatProvides a lightweight compatibility layer that…
permissive · top 15,000 on PyPI
recursive-diffRecursively compares two Python data structures…
permissive · top 15,000 on PyPI
percentifyPercentify provides one-call exploratory…
permissive · top 15,000 on PyPI
itablesRenders Pandas and Polars DataFrames as…
permissive · top 5,000 on PyPI
coolacoola compares complex nested data structures…
permissive · top 5,000 on PyPI
narwhalsNarwhals provides a lightweight compatibility…
permissive · top 1,000 on PyPI
chispaProvides assertion methods for testing PySpark…
permissive · top 5,000 on PyPI
pyreadstatReads and writes SAS, SPSS, and Stata data…
permissive · top 5,000 on PyPI
qpdQPD translates SQL SELECT statements into…
permissive · top 15,000 on PyPI