Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Pivot Table Creation

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

Pivot long product amounts to wide columns per date. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Pivot long so dates are rows, products are columns, values are summed amount, missing cells 0. Reset index so date is a column. Assign result.

Constraints

  • Include product columns A/B/C as present.
  • fill_value 0.

Examples

Input: long sales Output: date | A | B | C 2024-01-01 | 10.0 | 5.0 | 0.0 2024-01-02 | 7.0 | 0.0 | 3.0 Missing product/date pairs become 0.

Topics: lakebench, pandas, pivot_table.

More interview problems · All interview problems · Learn data engineering

beginner

Pivot Table Creation

Interview-style drill: Pivot long product amounts to wide columns per date.

Pivot `long` so dates are rows, products are columns, values are summed `amount`, missing cells 0. Reset index so `date` is a column. Assign `result`.