Skip to main content

pandas_diff

CI PyPI Python License: MIT

Generate event logs of row-level changes between two pandas DataFrames.

Not a statistical comparison tool — pandas_diff tells you what changed: which rows were created, deleted, or modified, and exactly which fields changed.

Installation

pip install pandas_diff

# With Parquet support
pip install pandas_diff[parquet]

Quick start

import pandas as pd
from pandas_diff import get_diffs

before = pd.DataFrame([
    {"hero": "hulk", "power": "strength"},
    {"hero": "black_widow", "power": "spy"},
    {"hero": "thor", "hammers": 0},
])
after = pd.DataFrame([
    {"hero": "hulk", "power": "smart"},
    {"hero": "captain marvel", "power": "strength"},
    {"hero": "thor", "hammers": 2},
])

df = get_diffs(before, after, keys="hero")
operation object_keys object_values attribute_changed old_value new_value
create [hero] captain marvel
delete [hero] black_widow
modify [hero] hulk power strength smart
modify [hero] thor hammers 0 2

CLI

pandas_diff before.csv after.csv --keys id
pandas_diff old.parquet new.parquet --keys name,date --format json
pandas_diff a.csv b.csv --keys id --ignore updated_at -o diff.csv

Supported file formats: CSV, JSON (flat records), Parquet.

Use cases

  • Batch to event-driven migration — Detect changes between pipeline runs and stream them to Kafka.
  • Audit event logs — Track how resources change over time.
  • Data conciliation — Compare a CMDB against the real state of infrastructure.
  • Environment sync — Propagate changes between production and disaster recovery.

API

get_diffs(
    before: pd.DataFrame,      # Previous state
    after: pd.DataFrame,        # Current state
    keys: list[str] | str,      # Column(s) identifying each row
    ignore_columns: list[str],  # Columns to skip (optional)
) -> pd.DataFrame

Returns a DataFrame with columns: operation, object_keys, object_values, object_json, attribute_changed, old_value, new_value.

License

MIT

Release files for pandas-diff 2.0.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 pandas-diff 2.0.0
File Size Uploaded
pandas_diff-2.0.0.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pandas-diff 2.0.0
File Interpreter ABI Platform
pandas_diff-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size:21.3 kB

Release files / pandas_diff-2.0.0.tar.gz

Download URL pandas_diff-2.0.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f36ade91e4d40eb13256b8b88abad2e7d2a95088e650adc3c26e220edc6d3c21
BLAKE2b-256 checksum
How to use checksums
d1a9a646978431a376a72a9f59f3067b3029ce88b1557dda10a370cacb2e8fb6
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 Apr 4, 2026.

Transparency log

Release files / pandas_diff-2.0.0-py3-none-any.whl

Download URL pandas_diff-2.0.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
573e3fadd76fc7b22a6c7add9f5b5d754283aa81586276cb46b3c3c7956aeab0
BLAKE2b-256 checksum
How to use checksums
2676b01d997992c145e4d29020752f6016416d4fa32129333deeb1a80a2f4c77
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 Apr 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.4.7

1 release file

1.4.6

1 release file

1.4.5

1 release file

1.4.4

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.0

2 release files

1.2.0

2 release files

1.1.0

1 release file

0.7.17

1 release file

0.7.10

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

2 release files

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