AnalystPath

Tasting Score Spread

PandasMediumMid level~10 min

Problem

You are given a DataFrame `entry` with columns `entry_id`, `roaster`, `aroma`, `body`, and `finish`. `entry_id` is unique. Each row is a coffee entered in a cupping contest, rated by judges on three attributes: `aroma`, `body`, and `finish`.

Each entry's total is the sum of its three attribute ratings. Return a single value in a column named `score_spread`, equal to the difference between the highest total score and the lowest total score across all entries.

Input data

Example rows — the live problem includes the full dataset.

entry
entry_idroasteraromabodyfinish
1Highland879
2Riverbend665
3Coastline998
4Summit453

Expected output

Your answer should return 1 row with the columns score_spread.

Starter code (Pandas (Python))

import pandas as pd

def tasting_score_spread(entry) -> pd.DataFrame:
    # Your code here
    return entry

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