AnalystPath

Times Each Chef Appears on the Menu

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `menu_board` with columns `dish_id`, `dish_name`, and `chef`. Each row is one dish currently listed on the tasting menu, attributed to the chef who created it (`dish_id` is unique).

Count how many dishes each chef has on the board. Output the chef's name and that count (name the count column `appearances`), ordered by `appearances` descending, breaking ties by `chef` ascending.

Input data

Example rows — the live problem includes the full dataset.

menu_board
dish_iddish_namechef
101Charred Leek TartRosa Linde
102Saffron GnocchiMarco Pell
103Smoked Plum BaoRosa Linde
104Ash Goat CheeseRosa Linde
105Yuzu SorbetMarco Pell

Expected output

Your answer should return 3 rows with the columns chef, appearances.

Starter code (Pandas (Python))

import pandas as pd

def times_each_chef_appears_on_the_menu(menu_board) -> pd.DataFrame:
    # Your code here
    return menu_board

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