AnalystPath

Poorly Received Recipes

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `recipes` with columns `recipe_id`, `upvotes`, and `downvotes`. `recipe_id` uniquely identifies each recipe, and each row gives how many upvotes and downvotes a recipe received. Every recipe has at least one vote.

A recipe is poorly received when its upvote share, `upvotes / (upvotes + downvotes)`, is strictly below `0.6`. Return the `recipe_id` of every poorly received recipe, ordered by `recipe_id` ascending.

Input data

Example rows — the live problem includes the full dataset.

recipes
recipe_idupvotesdownvotes
191
255
364
437

Expected output

Your answer should return 2 rows with the columns recipe_id.

Starter code (Pandas (Python))

import pandas as pd

def poorly_received_recipes(recipes) -> pd.DataFrame:
    # Your code here
    return recipes

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