Customers With No Orders
You're a data analyst at Whetcode Supply, an online shop selling desk gear. The growth team wants to run a win-back email at accounts that have gone quiet. Nobody who has bought recently should get one, and the team argues every campaign about how far back 'recently' reaches, so the date is set per campaign and arrives with the request.
The awkward part is that these customers are defined by something that isn't in the data. A customer who bought inside the window leaves a row you can point at. A customer who did not leaves nothing at all, so there is no row to go looking for — and an account that has never ordered in its life leaves nothing anywhere, at any date.
customers_df — one row per registered account. id is the number an order refers back to.
| id | name | city | signup_date |
|---|---|---|---|
| 1 | Priya Nair | Austin | 2022-01-15 |
| 2 | Tom Becker | Berlin | 2022-03-02 |
| 3 | Sofia Rossi | Milan | 2022-05-19 |
| 4 | Liam OConnor | Dublin | 2023-01-08 |
| 5 | Wei Zhang | Austin | 2023-04-27 |
| 6 | Ana Mendes | Austin | 2023-09-12 |
orders_df — one row per order placed. customer_id points at a row in the customers table.
| id | customer_id | product_id | quantity | order_date |
|---|---|---|---|---|
| 1 | 1 | 1 | 2 | 2023-02-01 |
| 2 | 1 | 4 | 1 | 2023-02-01 |
| 3 | 2 | 2 | 1 | 2023-02-10 |
| 4 | 3 | 3 | 3 | 2023-03-05 |
| 5 | 4 | 5 | 5 | 2023-03-11 |
| 6 | 1 | 3 | 1 | 2023-04-02 |
| 7 | 5 | 1 | 4 | 2023-05-20 |
| 8 | 2 | 5 | 2 | 2023-05-22 |
| 9 | 3 | 4 | 1 | 2023-06-01 |
| 10 | 5 | 2 | 1 | 2023-06-15 |
Input
Both DataFrames above are already built for you — the customer and order rows are not read from input. What does arrive is a single line holding the campaign's date, written the way order_date is written, as YYYY-MM-DD.
Task: Print a sorted Python list of the names of customers who placed no order on or after that date. The date is inclusive: an order placed exactly on it counts as recent, and that customer stays off the list. If every customer turned out to have ordered inside the window, an empty list would be the honest answer rather than a bug.
Example: if only Dana Reyes had gone quiet, you'd print ['Dana Reyes'].
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in