AnalystPath

High-Balance Loyalty Members

PandasEasyJunior level~10 min

Problem

You are given two DataFrames:
- `members` with `card`, `member_name`
- `pointevents` with `event_id`, `card`, `points`, `happened_on` (points may be positive for earning or negative for redeeming)

Each member's balance is the sum of all their point events. Return the members whose total balance is strictly greater than 10000.

Return columns `member_name` and `balance`. Members with no point events, or with a balance of 10000 or less, are excluded.

Input data

Example rows — the live problem includes the full dataset.

members
cardmember_name
700001Priya
700002Marco
700003Lena
pointevents
event_idcardpointshappened_on
170000170002021-08-01
270000170002021-09-01
3700001-30002021-09-02
470000210002021-09-12
570000360002021-08-07

Expected output

Your answer should return 1 row with the columns member_name, balance.

Starter code (Pandas (Python))

import pandas as pd

def high_balance_loyalty_members(members, pointevents) -> pd.DataFrame:
    # Your code here
    return members

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