AnalystPath

Promotion-Track Baristas

PandasMediumMid level~10 min

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
barista_idemailname
1mara@brewco.testMara
2devi@brewco.testDevi
3tom@brewco.testTom
weeklyvote
week_notop_picksecond_pickthird_pick
190123
191231
192312
193132
194456

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 barista

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