Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Customers with no orders

Pandas data engineering interview problem. Difficulty: beginner. Pattern: Merges. About 10 minutes. Part of the Pro drill bank.

Find customers that never appear in the orders table. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

customers has customer_id and name. orders has order_id and customer_id; a customer can appear many times and some order rows have a missing customer_id. Return the customers that have no order, with columns customer_id and name, sorted by customer_id with a clean index. Assign the DataFrame to result.

Requirements

  • Sorted by customer_id.

Constraints

  • customer_id is unique in customers.

Examples

Input: customers customer_id | name 1 | Ann 2 | Bo 3 | Cy 4 | Di 5 | Eli orders order_id | customer_id 10 | 1 11 | 1 12 | 3 13 | NULL 14 | 3 Output: customer_id | name 2 | Bo 4 | Di 5 | Eli Customers 1 and 3 have orders. The missing id in orders matches nobody. Bo (2), Di (4) and Eli (5) have none.

Topics: lakebench, pandas, anti join, isin, merge.

More interview problems · All interview problems · Learn data engineering

beginner

Customers with no orders

Interview-style drill: Find customers that never appear in the orders table.

`customers` has `customer_id` and `name`. `orders` has `order_id` and `customer_id`; a customer can appear many times and some order rows have a missing `customer_id`. Return the customers that have no order, with columns `customer_id` and `name`, sorted by `customer_id` with a clean index. Assign the DataFrame to `result`.