AnalystPath

Big-Spender Diners

PandasEasyJunior level~10 min

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_iddiner_idtotal_dollars
11095
21040
31130
41281

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 checks

Solve 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

Related Pandas questions