Merge on Keys and Indexes
Joining by columns or by index.
Same Name, One Word
When both tables share a column with the same name, on is all you need to merge them together.
orders.merge(customers, on="customer_id")Join on Many Keys
Sometimes one column is not enough. Pass a list to on and pandas matches rows on every key at once.
sales.merge(targets, on=["region", "month"])All lessons in this course
- Inner, Left, Right, and Outer
- Merge on Keys and Indexes
- concat to Stack and Append
- Diagnose Bad Joins