Safe joins

A safe join combines two tables without accidentally losing or duplicating rows. You need to check the uniqueness of the key on the expected side (for example with validate="many_to_one"), choose the right join type, and check the number of rows before and after, so that a duplicate key doesn't multiply rows.

Example

df.merge(clients, on="client_id", how="left", validate="many_to_one")

Related concepts

The whole glossary