Skip to main content

pandascompare

Package version License

pandascompare is a Python package designed to compare DataFrame objects, enabling you to quickly identify the differences between two datasets.

Installation

pip install pandascompare

Main Features

The PandasCompare class compares any two DataFrame objects along the following dimensions:

  • Rows ➔ missing rows based on the join key(s) specified via the join_on argument.
  • Columns ➔ name differences or missing columns.
  • Values ➔ value mismatches in content or type.

Example Usage

Please refer to the documentation within the code for more information.

Imports

from pandascompare import PandasCompare

Create DataFrames

First, let's create two sample DataFrame objects to compare.

import pandas as pd
import numpy as np

# February Data
left_df = pd.DataFrame({
    'id': [1, 2, 3],
    'date': [pd.to_datetime('2024-02-29')] * 3,
    'first_name': ['Alice', 'Mike', 'John'],
    'amount': [10.5, 5.3, 33.77],
    })

# January Data
right_df = pd.DataFrame({
    'id': [1, 2, 9],
    'date': [pd.to_datetime('2024-01-31')] * 3,
    'first_name': ['Alice', 'Michael', 'Zachary'],
    'last_name': ['Jones', 'Smith', 'Einck'],
    'amount': [11.1, np.nan, 14],
    })

Compare DataFrames

Next, we will initialize a PandasCompare instance to perform the comparison. Please consult the in-code documentation for a comprehensive list of available arguments.

pc = PandasCompare(
    left_data=left_df,
    right_data=right_df,
    left_label='feb',
    right_label='jan',
    join_on='id',
    left_ref=['first_name'],
    include_delta=True,
    verbose=True,
    )

Export to Excel

Finally, let's export the compare report to an Excel file to view the results.

pc.to_excel()

Metadata

Release files for pandascompare 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pandascompare 0.6.5
File Size Uploaded Provenance
pandascompare-0.6.5.tar.gz 9.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 19.7 kB

Release files / pandascompare-0.6.5.tar.gz

Download URL pandascompare-0.6.5.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2e851bdd3415c188340db1d4eacaffd1a53c87027445f865267dec91465ddec4
BLAKE2b-256 checksum
How to use checksums
a76d4159451114a22e5311a58fbca8df4856a2eb29c6b45f3df023565e08ad79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.12.10 Windows/11

Release files / pandascompare-0.6.5-py3-none-any.whl

Download URL pandascompare-0.6.5-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fcb6d580841d4eebc03a1a2c714577bac0bf5cf9b18eca188615b5580a73b766
BLAKE2b-256 checksum
How to use checksums
3c04496a1eda512457b5eb3d7ea930783450aefc9b55322a6b12585934a3c2cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.12.10 Windows/11

Security for pandascompare 0.6.5

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.

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