Skip to main content

autocrosswalk: A generic approach to crosswalking

This library automates crosswalks from one dataframe to another.

Please contact the authors below if you find any bugs or have any suggestions for improvement. Thank you!

Author: Nicolaj Søndergaard Mühlbach (n.muhlbach at gmail dot com, muhlbach at mit dot edu)

Code dependencies

This code has the following dependencies:

  • Python >=3.6
  • pandas >=1.3

Installation

There are no heavy dependencies for this library to work. We have included an example that requires a parquet reader, e.g., pyarrow, brotli, or fastparquet. One needs to have one of them installed in order to use the example data provided. Otherwise, go ahead and install by pip install autocrosswalk.

Usage

# Libraries
from autocrosswalk.main import AutoCrosswalk
from autocrosswalk.tools import load_example_data

# Load example data
data = load_example_data()

# Separate into old and new data, i.e., we crosswalk the 'data_from' to 'data_to' 
data_from = data.loc[data["DB"]=="db_20_0"]
data_to = data.loc[data["DB"]=="db_26_1"]

# Instantiate
autocrosswalk = AutoCrosswalk(n_best_match=3,
                              prioritize_exact_match=True,
                              enforce_completeness=True,
                              verbose=2)

# Generate crosswalk file
df_crosswalk = autocrosswalk.generate_crosswalk(df_from=data_from,
                                                df_to=data_to,
                                                numeric_key=['O*NET-SOC Code'],
                                                text_key=['Job title'])

# Perform crosswalk
df_updated = autocrosswalk.perform_crosswalk(crosswalk=df_crosswalk,
                                             df=data_from,
                                             values=["Data Value"],
                                             by=['Date', 'DB',
                                                 'Category', 'Element ID',
                                                 'Element Name','Element description'])

# Check if number of unique keys match
print(len(df_updated["O*NET-SOC Code"].unique()) == len(data_to["O*NET-SOC Code"].unique()))
print(len(df_updated["Job title"].unique()) == len(data_to["Job title"].unique()))

# Now, 'df_updated' has all new keys from 'data_to'!

Metadata

Release files for autocrosswalk 0.0.24

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

Source distribution (sdist)

Source distribution for autocrosswalk 0.0.24
File Size Uploaded Provenance Actions
autocrosswalk-0.0.24.tar.gz 1.2 MB Without provenance Details for autocrosswalk-0.0.24.tar.gz

Built distribution (wheel)

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

Total release size: 2.3 MB

Release files / autocrosswalk-0.0.24.tar.gz

Download URL autocrosswalk-0.0.24.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
13762265398400ae11767e2771a7dc25cbc77c2df3e66515e382950f0a18eada
BLAKE2b-256 checksum
How to use checksums
12ef00f70c0e003a000ba79e2260e15235be7cf492d38b483ca170f4b21d04df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 pkginfo/1.8.2 readme-renderer/27.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / autocrosswalk-0.0.24-py3-none-any.whl

Download URL autocrosswalk-0.0.24-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5a49639a58e56c804620e2f8c707b1e7f520fb90c58bd2a3c4c708519b221233
BLAKE2b-256 checksum
How to use checksums
ac42c5e4bcd6234b14508e37c046b56431c2a8e4894cd7ae663f9ff35afddf37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 pkginfo/1.8.2 readme-renderer/27.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Security for autocrosswalk 0.0.24

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.

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