BuildlyBuildly
DashboardExercisesProfileHelp
Data Science/Module 3: Importing & Handling Files/Pivot & Reshape1/3
Exercise·7 min·10 XP

Reshape Wide to Long

Context. A scores table is wide — one column per subject. For analysis you need it long: one row per student-subject pair.

Your task. Write to_long(df) that melts the wide table into columns student, subject, and score.

Example.

studentmathscience
Alice9085

becomes rows (Alice, math, 90) and (Alice, science, 85).

Notes. student stays as an identifier column. Every other column becomes a subject value.

Previous
Summarize with a Pivot Table
Next
Reshape Long to Wide