Highest Paid Employee
The CFO of Kestrel Labs is assembling a compensation slide for the board, and it goes team by team: one line per department naming the single highest-paid person on it. Not the figure — the board already has the payroll total — just who it is. The slide is put together one department at a time, so the department under review comes with the request.
The table makes the number easy and the person harder. Salary and name live in different columns, so the thing you actually want is not the thing the salary column hands you.
employees_df — one row per employee. salary is annual, in dollars. manager is the name of the person they report to, or None where nobody is recorded.
| id | name | department | salary | hire_date | manager |
|---|---|---|---|---|---|
| 1 | Ava Chen | Engineering | 145000 | 2021-03-14 | None |
| 2 | Ben Ortiz | Engineering | 118000 | 2022-06-01 | Ava Chen |
| 3 | Cara Novak | Engineering | 121000 | 2023-01-10 | Ava Chen |
| 4 | Deshawn Lee | Sales | 95000 | 2020-09-23 | None |
| 5 | Elin Kask | Sales | 88000 | 2022-11-05 | Deshawn Lee |
| 6 | Farid Amiri | Marketing | 76000 | 2023-04-18 | None |
| 7 | Grace Kim | Data | 132000 | 2021-07-30 | None |
| 8 | Hugo Silva | Data | 110000 | 2023-02-14 | Grace Kim |
| 9 | Ines Duarte | Data | 104000 | 2023-08-01 | Grace Kim |
| 10 | Jonas Weber | Sales | 91000 | 2021-12-19 | Deshawn Lee |
Input
The DataFrame above is already built for you — the employee rows are not read from input. What does arrive is a single line naming the department under review, spelled exactly as the department column spells it.
Task: Print the name of the highest-paid employee in that department on its own, as a plain string — no quotes, no brackets, no salary alongside it. Every department named in this table has somebody in it, and one of them has exactly one person; no two people on the same team are paid the same, so there is one right name each time.
Example: if the top earner on the team under review were called Rosa Blum, the entire output would be Rosa Blum.
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in