Merge Datasets

Medium
pandas Uber Airbnb

Perform an inner join on two lists of dictionaries based on a shared key column. Return a list of merged dictionaries containing all fields from both datasets.

Example

left = [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
right = [{"id": 1, "score": 90}, {"id": 3, "score": 70}]
inner_join(left, right, "id")
# => [{"id": 1, "name": "Alice", "score": 90}]

Test Cases

Python Editor

Output

Click "Run" to see results...