Combine Product Filters

Each record has product, category and numeric price. Return product names where category exactly matches wanted_category AND price is at most max_price. Keep original order and include the price boundary. Category matching is case-sensitive. Empty input or no matches returns an empty list.

Difficulty: beginner

Show hint

Combine two parenthesized boolean Series with &, not Python and. Select product for matching rows and call tolist().

Examples

  • [[{"product":"Tea","category":"food","price":10},{"product":"Mug","category":"home","price":8},{"product":"Rice","category":"food","price":15}],"food",10]["Tea"]

Your solution

Python · Pandas

Results

Python and Pandas load when you Run or Submit. Return a Python list, dictionary or scalar as requested.

Back to Lesson