Members Who Outscore Their Team Leader
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.
| member_id | full_name | points | leader_id |
|---|---|---|---|
| 1 | Dana | 70 | 3 |
| 2 | Omer | 80 | 4 |
| 3 | Rina | 60 | |
| 4 | Gil | 90 |
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 TeamMemberSolve 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