Gluten-Free Vegan Menu Items
Problem
A cafe stores its menu in a `menuitem` DataFrame, one row per dish. Each row has `dish_id`, `gluten_free` and `vegan`, where `gluten_free` and `vegan` are each `'T'` (yes) or `'F'` (no).
Return the `dish_id` of every dish that is **both** gluten free **and** vegan, in any order.
Input data
Example rows — the live problem includes the full dataset.
menuitem
| dish_id | gluten_free | vegan |
|---|---|---|
| 10 | T | F |
| 11 | T | T |
| 12 | F | T |
| 13 | T | T |
| 14 | F | F |
Expected output
Your answer should return 2 rows with the columns dish_id.
Starter code (Pandas (Python))
import pandas as pd
def gluten_free_vegan(menuitem: pd.DataFrame) -> pd.DataFrame:
# Your code here
return menuitemSolve 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