pandas_diff
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)
| File | Size | Uploaded | |
|---|---|---|---|
| pandas_diff-2.0.0.tar.gz | 13.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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