Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

GroupBy with Multiple Aggregations

Pandas data engineering interview problem. Difficulty: beginner. Pattern: GroupBy. About 12 minutes. Free to practice.

Per-region totals, average, count, and max amount in pandas. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

From sales, group by region and compute total_amount, avg_amount, txn_count, max_amount. Sort by region. Assign result.

Requirements

  • One row per region.

Constraints

  • Four metric columns.
  • Sort by region.

Examples

Input: sales Output: region | total_amount | avg_amount | txn_count | max_amount EU | 70.0 | 35.0 | 2 | 40.0 US | 140.0 | 35.0 | 4 | 60.0 Named aggregations keep column contracts clear.

Topics: lakebench, pandas, groupby, agg.

More interview problems · All interview problems · Learn data engineering

beginner

GroupBy with Multiple Aggregations

Interview-style drill: Per-region totals, average, count, and max amount in pandas.

From `sales`, group by `region` and compute `total_amount`, `avg_amount`, `txn_count`, `max_amount`. Sort by `region`. Assign `result`.