Promotion-Track Baristas
Problem
A coffee chain records its weekly top-three baristas. `weeklyvote` has columns `week_no`, `top_pick`, `second_pick`, `third_pick`; each pick column holds the `barista_id` placed in that rank that week. `barista` has columns `barista_id`, `email`, `name`.
A barista is on the **promotion track** if EITHER:
- they placed in the top three (any rank) in **three or more consecutive weeks**, OR
- they were the `top_pick` in **three or more** different weeks.
Report the `name` and `email` of every promotion-track barista, in any order.
Input data
Example rows — the live problem includes the full dataset.
| barista_id | name | |
|---|---|---|
| 1 | mara@brewco.test | Mara |
| 2 | devi@brewco.test | Devi |
| 3 | tom@brewco.test | Tom |
| week_no | top_pick | second_pick | third_pick |
|---|---|---|---|
| 190 | 1 | 2 | 3 |
| 191 | 2 | 3 | 1 |
| 192 | 3 | 1 | 2 |
| 193 | 1 | 3 | 2 |
| 194 | 4 | 5 | 6 |
Expected output
Your answer should return 3 rows with the columns name, email.
Starter code (Pandas (Python))
import pandas as pd
def promotion_track_baristas(weeklyvote, barista) -> pd.DataFrame:
# Your code here
return baristaSolve 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