Merge (SQL style join)
merge combines tables on key columns like a SQL join. The default is an inner join.
Example
import pandas as pd
import numpy as np
people = pd.DataFrame({'id': [1, 2, 3], 'name': ['Ada', 'Bob', 'Cy']})
orders = pd.DataFrame({'id': [1, 1, 3], 'total': [10, 20, 30]})
print(people.merge(orders, on='id'))Result
id name total 0 1 Ada 10 1 1 Ada 20 2 3 Cy 30
Exercise
Join on a key.
a.merge(b, on="")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.