AnalystPath

Members Who Outscore Their Team Leader

PandasEasyJunior level~10 min

Problem

**DataFrame: `TeamMember`**

| Column | Type |
|-----------|---------|
| member_id | int |
| full_name | varchar |
| points | int |
| leader_id | int |

`member_id` is unique. `leader_id` is the `member_id` of this person's team leader, or `None` for a member with no leader.

Return a DataFrame with one column `Member` holding the name of every member whose `points` are **strictly greater** than the `points` of their own team leader. Any order.

**Example** — Dana (70) reports to Rina (60), so Dana qualifies. Omer (80) reports to Gil (90), so he does not. Members with no leader cannot qualify.

Input data

Example rows — the live problem includes the full dataset.

TeamMember
member_idfull_namepointsleader_id
1Dana703
2Omer804
3Rina60
4Gil90

Expected output

Your answer should return 1 row with the columns Member.

Starter code (Pandas (Python))

import pandas as pd

def members_above_leader(TeamMember) -> pd.DataFrame:
    # Your code here
    return TeamMember

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