ddiff
See what changed between two data files. Ten million rows in six seconds.
parquet · CSV · TSV · JSON · JSON lines · Excel · Arrow, compared with DuckDB, shown with Textual
uv tool install ddiff-tui # or: pipx install ddiff-tui
ddiff old.parquet new.parquet
Why ddiff?
The pipeline changed, the vendor re-sent the file, someone "only refactored" a
query. Is the output the same? diff is useless on parquet and drowns on CSV.
Usually it ends in a notebook with pd.merge(..., indicator=True), running out
of memory.
ddiff old new tells you straight away:
- Which rows were added, removed or changed, matched on a key. ddiff finds a
key for you (a column unique in both files, preferring id-like names) or you
pass
--key. Rows can be in any order. With no key it compares row by row. - Which columns changed and how much: columns added and removed, type changes, the number of changed cells in each column, and how each column's nulls, distinct values, min, max and mean moved.
- Every changed cell as
old → new, filtered to one column, sorted by the size of the change, and with any row's fields shown old beside new. - Files bigger than RAM. DuckDB reads both files into a temporary on-disk database and does the join. Only the rows that differ are stored, and the table pages them in 64 rows at a time.
- Scripts and CI too:
--summaryor--jsonprint the result, and the exit code is 0 when the files match, 1 when they differ and 2 on an error, likediff.-o diff.parquetsaves the differences. - The SQL is yours:
Sshows the DuckDB SQL behind the diff, ready to run.
How fast?
Two 10,000,000-row trade files (180 MB and 230 MB of parquet; 1% of prices nudged, 0.2% of venues changed, 9,890 rows deleted, 20,000 added, a column dropped and one added), on a 2017 laptop (i7-7700HQ, 4 cores):
| Diff two parquet files, choosing the key itself | 6.0 s (1.4 GB RAM) |
| The same data as CSV (630 MB each) | 9.2 s |
| Scroll, page, jump to the last of 149,229 differing rows | instant (3 ms a block) |
| Sort the differences by the size of the price change | 0.02 s |
| Show only the rows where price changed | 0.02 s |
| Per-column stats for both files | 1 s (in the background) |
Make the same files with uv run python tools/make_demo_data.py and try it.
Summary
Both files, how rows were matched, how many were unchanged, changed, added and
removed, which columns came and went, and which columns' values changed most.
ddiff old new --summary prints the same thing in your terminal.
Columns
One row per column: whether it's the key, added, removed or changed, its type on
both sides, the share of rows whose value changed, and nulls, distinct values,
mean, min and max for the old and new file. A stat that moved is highlighted.
Type to filter by name and s to sort. Enter or c opens the column:
The commonest old → new changes, the size of the numeric changes (new − old),
and the distribution of values in both files. f shows the rows where it changed.
Rows
Every differing row, with the key pinned at the left. A changed value shows as
old → new, and new rows are green and removed ones red. Columns with no
changes are hidden until you press u.
+-~(orarm) show or hide added, removed and modified rowsfshows only the rows where the cursor's column changedssorts by a column,dby the size of the change, biggest firstEntershows the row with every field old beside new;↑↓step through rowswsaves the rows on show,Dopens them in dx
Options
ddiff old.parquet new.parquet # explore
ddiff old.csv new.csv -k id # match rows on id
ddiff a.parquet b.parquet -k date,ticker # a key of two columns
ddiff a.xlsx::Sheet1 b.xlsx::Sheet1 # Excel sheets
ddiff a.parquet b.parquet --atol 1e-9 # numbers this close are equal (also --rtol)
ddiff a.parquet b.parquet -w "region = 'EU'" # an SQL filter on both files
ddiff a.parquet b.parquet -c price,qty # compare only these columns
ddiff a.parquet b.parquet -i updated_at # ignore these columns
ddiff a.parquet b.parquet --summary # print; exit 0 same, 1 different, 2 error
ddiff a.parquet b.parquet --json # the summary as JSON
ddiff a.parquet b.parquet -o diff.parquet # save the differing rows and exit
Duplicate keys are matched in file order: the second id = 7 in the old file
pairs with the second id = 7 in the new one. Numbers compare across integer and
float types. Other type changes compare as text and are listed in the summary.
NULL is shown as ∅, "" is an empty string, and values that differ only in
whitespace are shown quoted so you can see the difference.
Keys
| Key | |
|---|---|
1 2 3 |
Summary · Columns · Rows |
arrows / hjkl · PgUp PgDn · g G · Home End |
move · page · top / bottom · first / last column |
Enter · c |
row old beside new (Rows) or column details (Columns) · column details |
s · d |
sort: ascending → descending → off · by size of change |
f · + - ~ · u · x |
only this column's changes · added / removed / modified · unchanged columns · clear |
/ · < > |
find a column · narrower / wider |
w · D · S |
save · open in dx · the SQL |
? · ctrl+p · q |
all keys · command palette and themes · quit |
Development
just sync # install dev dependencies
just ci # lint, format check and tests, as in CI
just examples # example file pairs to play with (see examples/README.md)
just shots # README screenshots (makes the 10 M row demo files first)
Pushing to main with a new version in pyproject.toml publishes it to PyPI
(as ddiff-tui; plain ddiff was taken) and creates a GitHub release.
See DEVELOPMENT_NOTES.md for how it works and what was learned building it.
MIT licence.
Metadata
Release files for ddiff-tui 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| ddiff_tui-0.1.0.tar.gz | 1.0 MB | Without provenance | Details for ddiff_tui-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ddiff_tui-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ddiff_tui-0.1.0-py3-none-any.whl |
Total release size: 1.1 MB
Release files / ddiff_tui-0.1.0.tar.gz
| Download URL | ddiff_tui-0.1.0.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
887df0f533a06294aba46c6827ba9d8df172209032c77e8b74a45175c28f6503
|
|
BLAKE2b-256 checksum How to use checksums |
4a53efc88b0998a35c38e9ea18b9f5e9f4a89d68b700da3fd39224b3f78f7817
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ddiff_tui-0.1.0-py3-none-any.whl
| Download URL | ddiff_tui-0.1.0-py3-none-any.whl |
|---|---|
| Size | 36.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bde877a8d09a91826ffe813b0fc2522c2e4ee93faa8bf73936210e96c34c720b
|
|
BLAKE2b-256 checksum How to use checksums |
aeada7a79244b18b543b8e66e0e5d72ac71b724f69cf6b54171e1050dec3dc08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for ddiff-tui 0.1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.