AnalystPath

Gyms With Membership Growth in 2023

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `gymbranches` with columns `branch_id`, `season`, and `net_signups`. Each row records the net change in active members at a gym branch during a given season; `net_signups` can be negative when more members cancelled than joined.

Report the `branch_id` of every branch whose `net_signups` in season `2023` was **strictly greater than 0**.

Return a single column `branch_id` in any order.

Input data

Example rows — the live problem includes the full dataset.

gymbranches
branch_idseasonnet_signups
1202250
12023120
22023-30
320230
420238

Expected output

Your answer should return 2 rows with the columns branch_id.

Starter code (Pandas (Python))

import pandas as pd

def gyms_with_membership_growth(gymbranches) -> pd.DataFrame:
    # Your code here
    return gymbranches

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