Practice / selecting and filtering

Large and In Charge

easy

The Daily Grind coffee chain is having a moment: a customer ordered a large drink so expensive the register printed a receipt in italics. The shift manager wants a list of every big spender order to study.

You have the orders DataFrame:

Your task: return every order that is size "large" and has a price greater than 6.00. Keep only the columns order_id, drink, and price.

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

ordersinput DataFrame

Schema
columntype
order_idlong
drinkstring
sizestring
pricedouble
tipdouble
Sample rows (first few)
order_iddrinksizepricetip
1001oat lattelarge6.51
1002drip coffeesmall30
1003caramel macchiatolarge7.252
1004flat whitemedium51.5
1005cold brewlarge5.50.5
1006espressosmall2.50.75
1007mochalarge6.750.25
1008lattemedium5.252
1009gold-dust affogatosmall6.50.75
1010barrel-aged cold brewlarge60.5
Expected output shape
order_iddrinkprice· 3 rows
Hint

Two steps: filter with both conditions combined by & (wrap each condition in parentheses!), then select the three columns the shift manager asked for.

Lesson refresher

This problem builds on Selecting & Filtering (~6 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.