pbPassingBI
/

How do you check that a merge worked correctly?

intermediate
Answer

Three things, in order.

Row count — compare len() before and after. A left merge should not change it; if it grew, the right side has duplicate keys.

Match rateindicator=True adds a _merge column, and value_counts() on it shows how many rows matched, and how many came from one side only.

Assert the relationshipvalidate='many_to_one' raises immediately if the keys are not what you assumed, turning a silent data-quality bug into an error at the point it happens.

Related