Build a column crosswalk between dataset versions by matching on column names and column contents.
Project description
field-match
Names, types, and values can all shift between data releases, quietly breaking anything downstream that assumes a stable schema. field-match builds a column crosswalk between two dataset versions: it compares every column pair on name and content, then reports which columns still match (verified), which appear renamed, which share a name but no longer match in content (suspect), and which were added or dropped.
The alternative is checking column by column, by hand and against documentation that may be buried. field-match makes that first pass in one call and flags what needs review.
Unlike other libraries in the data validation and data quality ecosystem, field-match builds the crosswalk itself rather than assuming you already have one. Some tools diff values once you know the mapping; others require you to write the mapping out as rules. field-match instead treats your last clean release as the reference and works the mapping out from name and content matching. It works across numeric, datetime, boolean, and text columns, reads CSV, Stata, SAS, and fixed-width files with no extra dependencies, plus Excel, Parquet, SPSS, and R via optional extras, and a browser-based version (no install) runs the same matching in-browser via Pyodide.
Developed for recurring public-interest data releases, where column drift is common.
No Python? Try the web app: https://cstirry.github.io/field-match/. Drop in two files, nothing to install.
Quick start
pip install field-match
from field_match import compare, read_table
new_data = read_table("survey_2022.xlsx")
report = compare("survey_2021.csv", new_data)
print(report)
16 verified column name and contents both match
64 renamed contents match, but under a different column name
4 suspect column name matches, but contents do not
21 dropped missing from the new dataset
76 added missing from the reference dataset
Review the proposed mapping, then apply it: df = report.apply(new_data). The reference can be a previous dataset, a list of expected column names, or a fitted sklearn model.
Full documentation: the report in depth, supported file formats, tuning, how matching works, and the API reference.
Examples with real data
Four scripts in examples/ download real government releases and crosswalk them to identify column drift:
- CDC/ATSDR Social Vulnerability Index (
cdc_atsdr_svi.py, or as a notebook:cdc_atsdr_svi.ipynb/ Colab): column name reused differently - CDC 500 Cities/PLACES (
cdc_places.py): column renames identified by content - IMLS Public Libraries Survey (
imls_pls.py): thirty years of column drift - NAMCS (
namcs_formats.py): SAS, Stata, and R datasets
Walkthroughs in the docs.
Development
See CONTRIBUTING.md for setup, tests, docs, and the release process.
License
MIT; see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file field_match-0.4.0.tar.gz.
File metadata
- Download URL: field_match-0.4.0.tar.gz
- Upload date:
- Size: 85.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17ec61c3bf7d953f89928ecc9f52cc7478c6293e070d9308ef35adc15696c60e
|
|
| MD5 |
0255ba0505121fb31f287b766fd430ac
|
|
| BLAKE2b-256 |
466744bbd4b526cd2161f3da15e3e390ffb3335a7c9628e2c453ac65abf0a2f9
|
Provenance
The following attestation bundles were made for field_match-0.4.0.tar.gz:
Publisher:
publish.yml on cstirry/field-match
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
field_match-0.4.0.tar.gz -
Subject digest:
17ec61c3bf7d953f89928ecc9f52cc7478c6293e070d9308ef35adc15696c60e - Sigstore transparency entry: 2193230380
- Sigstore integration time:
-
Permalink:
cstirry/field-match@9e17cab62fba4155d779ccd0b482a2b92a678fbb -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/cstirry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9e17cab62fba4155d779ccd0b482a2b92a678fbb -
Trigger Event:
release
-
Statement type:
File details
Details for the file field_match-0.4.0-py3-none-any.whl.
File metadata
- Download URL: field_match-0.4.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7795d5b1e03954e668838bf9760460b82442d647ad0d95afd815debd56eb4dd9
|
|
| MD5 |
6c6c22ff05694a57e4ef77fcdb9d3b2c
|
|
| BLAKE2b-256 |
5d2d6eec5c469063df7c6fb6b6b3852760e4f9d350decb3ddd650e894941a592
|
Provenance
The following attestation bundles were made for field_match-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on cstirry/field-match
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
field_match-0.4.0-py3-none-any.whl -
Subject digest:
7795d5b1e03954e668838bf9760460b82442d647ad0d95afd815debd56eb4dd9 - Sigstore transparency entry: 2193230395
- Sigstore integration time:
-
Permalink:
cstirry/field-match@9e17cab62fba4155d779ccd0b482a2b92a678fbb -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/cstirry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9e17cab62fba4155d779ccd0b482a2b92a678fbb -
Trigger Event:
release
-
Statement type: