Create intermediate Works with: Any AI

Merge Validation With Indicator Columns

Structured brief

Prove a join did what you intended.

The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.

Rate this prompt

Loading ratings…

Help me validate a pandas merge before I trust the result. The two tables, their keys and row counts: [TABLES_KEYS_COUNTS]. The merge code: [MERGE_CODE]. What I expect (one-to-one, one-to-many): [EXPECTED_RELATIONSHIP].

Write a validation routine in five steps with code for each: check key uniqueness and nulls on both sides; run the merge with indicator=True and the validate argument matching my expected relationship; tabulate left_only, right_only, and both with counts and percentages; sample ten unmatched rows from each side and show how to inspect why they did not match (case, whitespace, type, leading zeros); and reconcile row counts before and after with a formula. Return the code as a reusable function that raises a clear error message when expectations fail and prints a short report. Explain how to interpret each outcome and what fix to try first. Quality bar: use only standard pandas features and state the minimum version that supports each argument.

Fill in before use

Optional: type your details and the prompt above updates. Nothing is saved or sent.

Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.

Related prompts