Poorly Received Recipes
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.
| recipe_id | upvotes | downvotes |
|---|---|---|
| 1 | 9 | 1 |
| 2 | 5 | 5 |
| 3 | 6 | 4 |
| 4 | 3 | 7 |
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 recipesSolve 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