Orders from a set of customers

Data framesMedium7 min

Your task

Given orders with columns order_id, customer, amount, status and placed, and a list of customer names, return the orders placed by any of them. Return only order_id and customer, sorted by order_id ascending.

Examples

orders_from(orders: dataframe, names: list[str]) -> dataframe
Example 1
Inputorders_from(orders, ["ada", "cy"])
orders
order_idcustomeramountstatusplaced
1ada120.5paid2024-01-05
2bo80refunded2024-01-07
3ada45.25paid2024-02-11
4cy200paid2024-02-14
5bo15.75pending2024-03-02
6ada60paid2024-03-19
Output
order_idcustomer
1ada
3ada
4cy
6ada