Times Each Chef Appears on the Menu
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.
| dish_id | dish_name | chef |
|---|---|---|
| 101 | Charred Leek Tart | Rosa Linde |
| 102 | Saffron Gnocchi | Marco Pell |
| 103 | Smoked Plum Bao | Rosa Linde |
| 104 | Ash Goat Cheese | Rosa Linde |
| 105 | Yuzu Sorbet | Marco 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_boardSolve 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