AnalystPath

Gluten-Free Vegan Menu Items

PandasEasyJunior level~10 min

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_idgluten_freevegan
10TF
11TT
12FT
13TT
14FF

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 menuitem

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