Skip to main content

DataComPy

PyPI - Python Version Code style: black 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 (via snowpark)
  • Dask (via Fugue)
  • DuckDB (via Fugue)

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[fugue]
pip install datacompy[snowflake]

Legacy Spark Deprecation

With version v0.12.0 the original SparkCompare was replaced with a Pandas on Spark implementation. The original SparkCompare implementation differs from all the other native implementations. To align the API better, and keep behaviour consistent we are deprecating the original SparkCompare into a new module LegacySparkCompare

Subsequently in v0.13.0 a PySpark DataFrame class has been introduced (SparkSQLCompare) which accepts pyspark.sql.DataFrame and should provide better performance. With this version the Pandas on Spark implementation has been renamed to SparkPandasCompare and all the spark logic is now under the spark submodule.

If you wish to use the old SparkCompare moving forward you can import it like so:

from datacompy.spark.legacy import LegacySparkCompare

SparkPandasCompare Deprecation

Starting with v0.14.1, SparkPandasCompare is slated for deprecation. SparkSQLCompare is the prefered and much more performant. It should be noted that if you continue to use SparkPandasCompare that numpy 2+ is not supported due to dependency issues.

Supported versions and dependncies

Different versions of Spark, Pandas, and Python interact differently. Below is a matrix of what we test with. With the move to Pandas on Spark API and compatability issues with Pandas 2+ we will for the mean time note support Pandas 2 with the Pandas on Spark implementation. Spark plans to support Pandas 2 in Spark 4

Spark 3.2.4 Spark 3.3.4 Spark 3.4.2 Spark 3.5.1
Python 3.10
Python 3.11
Python 3.12
Pandas < 1.5.3 Pandas >=2.0.0
Compare
SparkPandasCompare
SparkSQLCompare
Fugue

[!NOTE] At the current time Python 3.12 is not supported by Spark and also Ray within Fugue. If you are using Python 3.12 and above, please note that not all functioanlity will be supported. Pandas and Polars support should work fine and are tested.

Supported backends

  • Pandas: (See documentation)
  • Spark: (See documentation)
  • Polars: (See documentation)
  • Snowflake/Snowpark: (See documentation)
  • Fugue is a Python library that provides a unified interface for data processing on Pandas, DuckDB, Polars, Arrow, Spark, Dask, Ray, and many other backends. DataComPy integrates with Fugue to provide a simple way to compare data across these backends. Please note that Fugue will use the Pandas (Native) logic at its lowest level (See documentation)

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.

Roadmap

Roadmap details can be found here

Download files

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

Source Distribution

datacompy-0.16.6.tar.gz (92.7 kB view details)

Uploaded Source

Built Distribution

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

datacompy-0.16.6-py3-none-any.whl (76.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datacompy-0.16.6.tar.gz
  • Upload date:
  • Size: 92.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for datacompy-0.16.6.tar.gz
Algorithm Hash digest
SHA256 e4558507d793ffec5e31d14c3d19923e1268e6c0f840e2026dace9420c6c34b8
MD5 72d3ed3db237067099ae361a19d7024d
BLAKE2b-256 fb62a8f7465e94b8e612ac7df3fb5fc0d6473de754404ac9a33f1f68f2d8563c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datacompy-0.16.6-py3-none-any.whl
  • Upload date:
  • Size: 76.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for datacompy-0.16.6-py3-none-any.whl
Algorithm Hash digest
SHA256 615e722775aa9d36853f7cfae7fdce970937a5e2f6eaa0b0cdb9f812255bfe03
MD5 5a0ad27ff3d8261356ad788cabddaf03
BLAKE2b-256 d56a8bdfb21ed6680c94c389c7040cf0890b2420af3aa300317bc21572b7287b

See more details on using hashes here.

Release history Release notifications | RSS feed

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