AnalystPath

Fully Certified Staff

PandasMediumMid level~10 min

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
staff_idfull_nameteam
1NadiaSecurity
2OmarSecurity
3PriyaLogistics
4QuinnLogistics
modules
module_idtitlehoursteam
101Threat Modelling3Security
102Incident Response3Security
103Warehouse Safety4Logistics
104Fleet Routing4Logistics
attempts
staff_idmodule_idtermresult
1101Q1 2024Pass
1102Q1 2024Pass
2101Q1 2024Fail
2102Q1 2024Pass
3103Q1 2024Pass

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 staff

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