AnalystPath

Mentors With At Least Five Mentees

PandasMediumMid level~10 min

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.

researcher
res_idfull_namelabmentor_id
1NoaX
2EliX1
3TalX1
4RoiX1
5MiaX1

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 researcher

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