Skip to main content

Dataframe comparisons in Python

Project description

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
  • Snowflake

[!IMPORTANT] datacompy has released v1. The v0.19.x line is no longer supported — users should upgrade to v1 going forward. The support/0.19.x branch is archived and will only receive critical security fixes on a best-effort basis; no new features or regular maintenance will be provided. All active development targets main.

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

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

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

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datacompy-1.0.3.tar.gz (121.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datacompy-1.0.3-py3-none-any.whl (74.1 kB view details)

Uploaded Python 3

File details

Details for the file datacompy-1.0.3.tar.gz.

File metadata

  • Download URL: datacompy-1.0.3.tar.gz
  • Upload date:
  • Size: 121.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for datacompy-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1a2f611c6d251aba4ded0d0b881a2e9f0dc5211c9149c95ca816508eb86da831
MD5 52c9b69e9c647c034221626c5a170f03
BLAKE2b-256 27c8c299f679f9ab6858da5b52ebb4d2610203c313a40c4797a7c13870c5d2b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for datacompy-1.0.3.tar.gz:

Publisher: publish-package.yml on capitalone/datacompy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datacompy-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: datacompy-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 74.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for datacompy-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e668e24fcb28c32d42ca4cca25053ba220d7f2f384da10f56460f9b1b5bc76ba
MD5 f9712be4df2ca126431774c8c7dc8cb8
BLAKE2b-256 b2ba9fd56a97e7e256fb70cb5c298a3af87ce719275c47dd0e4a0f4b01028a72

See more details on using hashes here.

Provenance

The following attestation bundles were made for datacompy-1.0.3-py3-none-any.whl:

Publisher: publish-package.yml on capitalone/datacompy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page