Fully Certified Staff
Problem
A company tracks training in three DataFrames:
- `staff` with columns `staff_id`, `full_name`, `team`.
- `modules` with columns `module_id`, `title`, `hours`, `team`.
- `attempts` with columns `staff_id`, `module_id`, `term`, `result`.
Every team has a set of required modules (the modules whose `team` matches the staff member's `team`). Find every staff member who has a passing attempt (`result` == 'Pass') in every required module for their team. A person counts only if they passed all of their team's modules, with no module left unattempted or failed.
Return a single column `staff_id`, ordered ascending.
Input data
Example rows — the live problem includes the full dataset.
| staff_id | full_name | team |
|---|---|---|
| 1 | Nadia | Security |
| 2 | Omar | Security |
| 3 | Priya | Logistics |
| 4 | Quinn | Logistics |
| module_id | title | hours | team |
|---|---|---|---|
| 101 | Threat Modelling | 3 | Security |
| 102 | Incident Response | 3 | Security |
| 103 | Warehouse Safety | 4 | Logistics |
| 104 | Fleet Routing | 4 | Logistics |
| staff_id | module_id | term | result |
|---|---|---|---|
| 1 | 101 | Q1 2024 | Pass |
| 1 | 102 | Q1 2024 | Pass |
| 2 | 101 | Q1 2024 | Fail |
| 2 | 102 | Q1 2024 | Pass |
| 3 | 103 | Q1 2024 | Pass |
Expected output
Your answer should return 2 rows with the columns staff_id.
Starter code (Pandas (Python))
import pandas as pd
def fully_certified_staff(staff, modules, attempts) -> pd.DataFrame:
# Your code here
return staffSolve 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