Inner Merge of Two DataFrames

easypandas_manipulation

Implement inner_merge(left, right, key).

Return the inner merge of left and right on key: only rows whose key value appears in both DataFrames are kept. Use pd.merge().

orders = pd.DataFrame({"id":[1,2,3], "item":["a","b","c"]})
prices = pd.DataFrame({"id":[1,3],   "price":[10,30]})
inner_merge(orders, prices, "id")
#    id item  price
# 0   1    a     10
# 1   3    c     30

Your solution

Edit inner_merge and run the real pytest suite in your browser — no install required. Your code is saved locally.

⌘/Ctrl + ↵

Loading the Python runtime (first run only)…

Hints

Hint 1

pd.merge(left, right, on=key, how='inner') performs an SQL-style inner join.

Hint 2

Rows whose key value has no match in the other DataFrame are dropped.

Hint 3

When one side has multiple rows with the same key, every combination is included (Cartesian product within that key).