AnalystPath

Top Bakery Showdown

PandasEasyJunior level~10 min

Problem

Two bakeries compete on five-star reviews. You are given two DataFrames, `sunrise_bakery` and `harbor_bakery`, each loaded from a CSV with columns `(review_id, stars)` where `stars` runs from 1 to 5.

The `champion` is the bakery with MORE five-star reviews (`stars == 5`). Return a single-column DataFrame `champion` with:
- `'Sunrise Bakery'` if Sunrise has strictly more five-star reviews,
- `'Harbor Bakery'` if Harbor has strictly more,
- `'Tie'` if both have the same count.

Input data

Example rows — the live problem includes the full dataset.

sunrise_bakery
review_idstars
15
25
34
45
harbor_bakery
review_idstars
15
23
35

Expected output

Your answer should return 1 row with the columns champion.

Starter code (Pandas (Python))

import pandas as pd

def top_bakery_showdown(sunrise_bakery, harbor_bakery) -> pd.DataFrame:
    # Your code here
    return sunrise_bakery

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