Terminal showing the command: pip install mergeprep.

Tooling · Data

Mergeprep

A Python package, built on pandas, that makes row-wise merging of messy tables reliable and repeatable: it prepares tables, finds matching columns, suggests merge keys, and explains why a merge succeeded or failed.

Focus

Python package · Data wrangling · Pipeline tooling

Built with

pandas · cookiecutter (py-pkgs template)

Code

GitHub

Overview

Mergeprep makes row-wise merging of messy tables reliable and repeatable, built on top of pandas. It handles the common real-world problems that break merges or produce wrong results: inconsistent table layouts, mismatched column names, different value formats, and unclear join keys.
The package prepares tables into merge-ready structures, measures similarity between tables and columns, and automatically suggests likely merge keys from patterns in the data. Its diagnostics explain why a merge succeeded or failed, flagging low key uniqueness, key mismatches, duplicates, or unexpected row expansion, so a problem can be fixed and the merge run with confidence.
Install pip install mergeprep. Built with cookiecutter and the py-pkgs-cookiecutter template; full details are on the GitHub page.

Functions

The package exposes five functions:
calc_match_rate() Compares every column pair between two tables and quantifies how much their values overlap, to identify likely merge keys.
convert_style() Standardizes values from two columns into a common format so differently written but equivalent entries merge reliably.
similarity_mapping() Analyzes two columns to find and rank similar values, producing a mapping that aligns mismatched labels across tables.
merge_with_mapping() Merges two tables using a shared canonical key derived from optional value mappings, while preserving the original merge context.
diagnose_merge() Summarizes a merge by reporting match rates, row counts, and value conversions to explain why it succeeded or failed.