Practice / joins

Name That Product

easy

Waveform's merch team logs sales by product_id, but the report needs human-readable product names.

You have two DataFrames:

sales

products

Your task: for each sale that has a matching product, return the product name and the qty. Sales with no matching product should be dropped.

Assign your answer DataFrame to result. Row order doesn't matter.

salesinput DataFrame

Schema
columntype
sale_idlong
product_idlong
qtylong
Sample rows
sale_idproduct_idqty
1102
2111
3995

productsinput DataFrame

Schema
columntype
product_idlong
namestring
Sample rows
product_idname
10Notebook
11Pen
Expected output shape
nameqty· 2 rows
Hint

sales.join(products, on="product_id", how="inner") keeps only sales whose product exists, then select("name", "qty").

Lesson refresher

This problem builds on Joins (~8 min). Pop it open in a new tab if you want a quick recap.

Loading editor…
Hit Run to execute your code and see the output here.