Big-Spender Diners
Problem
A restaurant keeps a DataFrame `checks` (loaded from a CSV) with columns `(check_id, diner_id, total_dollars)` — one paid bill per row.
A diner is a 'big spender' if they have at least one check whose `total_dollars` is strictly greater than 80. Return a single-column DataFrame `big_spenders` holding the number of distinct big-spender diners.
Input data
Example rows — the live problem includes the full dataset.
checks
| check_id | diner_id | total_dollars |
|---|---|---|
| 1 | 10 | 95 |
| 2 | 10 | 40 |
| 3 | 11 | 30 |
| 4 | 12 | 81 |
Expected output
Your answer should return 1 row with the columns big_spenders.
Starter code (Pandas (Python))
import pandas as pd
def big_spender_diners(checks) -> pd.DataFrame:
# Your code here
return checksSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock