Python
#34

Implement SQL HAVING Logic Using groupby().filter() in Pandas

Medium
Interview Question #34

Given an `orders` DataFrame, keep only the rows belonging to customers whose average order value across all their purchases exceeds $500.

Input Table: orders
4 rows preview
order_idcustomer_idamount
1101800
2101400
3102100
4102200
Expected Output Structure2 rows
order_idcustomer_idamount
1101800
2101400
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

Python 3.10 (Pandas)
Environment Ready

Click "Run & Test" to execute your Pandas code against the test assertions.

Chat with us