AnalystPath

Members Who Qualify for Loyalty Points (List)

PandasEasyJunior level~10 min

Problem

You are given one DataFrame `renewals` with columns `member_id`, `renewed_at`, and `fee_cents`. The pair `(member_id, renewed_at)` is unique.

A member qualifies for loyalty points if they made at least one renewal during the inclusive window from `'2023-09-01'` to `'2023-09-30'` that cost at least 5000 cents.

Return the `member_id` of every qualifying member, ordered by `member_id` ascending.

Input data

Example rows — the live problem includes the full dataset.

renewals
member_idrenewed_atfee_cents
12023-09-04 10:00:005200
12023-09-18 11:00:005200
22023-09-10 09:00:004000
32023-08-30 12:00:009000
42023-09-29 23:00:005000

Expected output

Your answer should return 2 rows with the columns member_id.

Starter code (Pandas (Python))

import pandas as pd

def qualifying_member_list(renewals) -> pd.DataFrame:
    # Your code here
    return renewals

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