Checklist

Name what one row means before joining two tables

The join may be working perfectly on the wrong relationship.

When it fits

  • A merge produces plausible columns but unexpectedly more rows or larger totals.

When to avoid it

  • A legitimate one-to-many join expands rows. Null-key behavior also differs between tools, so do not assume SQL and spreadsheet-like joins are identical.

Checklist

  • Name the complete business key on each side, including relevant date or organizational scope.
  • Check uniqueness on the side that is supposed to contain one match.
  • Inspect unmatched keys and compare row counts and meaningful totals before and after the join.

Why it matters

State the grain: what does one row represent in each input? Then specify how many matches are allowed for the chosen key. Check that expectation before accepting the joined result; do not remove duplicates afterward merely to recover a familiar row count.

An example

Joining sales lines to several historical customer versions by customer number alone multiplies each sale.

Check your result

The observed match count agrees with the declared relationship, and exceptions have an explanation.

Keep this limit in mind

  • A legitimate one-to-many join expands rows. Null-key behavior also differs between tools, so do not assume SQL and spreadsheet-like joins are identical.

Connected ideas

Useful with
Reconcile what is missing and what should never have arrived

Evidence and sources

Supports

pandas can validate one-to-one, one-to-many or many-to-one merge keys; allowing many-to-many does not perform a uniqueness check.

Key uniqueness is a structural property, not proof that the selected join represents the intended relationship.

pandas.merge · validate parameter

All sources (1)