Mentors With At Least Five Mentees
Problem
You are given a DataFrame `researcher`.
```text
+-----------+-----------+--------+-----------+
| Column | Type |
+-----------+-----------+
| res_id | int |
| full_name | object |
| lab | object |
| mentor_id | int |
+-----------+-----------+
res_id is the unique key. mentor_id points to the res_id of this researcher's mentor (it may be NULL).
```
Find every researcher who personally mentors **at least five** other researchers. Return a DataFrame with a single column `full_name`. Result order does not matter.
Input data
Example rows — the live problem includes the full dataset.
| res_id | full_name | lab | mentor_id |
|---|---|---|---|
| 1 | Noa | X | |
| 2 | Eli | X | 1 |
| 3 | Tal | X | 1 |
| 4 | Roi | X | 1 |
| 5 | Mia | X | 1 |
Expected output
Your answer should return 1 row with the columns full_name.
Starter code (Pandas (Python))
import pandas as pd
def big_mentors(researcher: pd.DataFrame) -> pd.DataFrame:
# Your code here
return researcherSolve 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