Drills tagged with this skill, unpassed first. Pass them all to mark the skill ready for scenarios.
sales_pivot(df) that returns a pivot table with one row per region, one column per quarter, and the sum of amount in each cell. Turn the region index back into a regular column.
Example. rows for East/Q1 and East/Q2 collapse to a single East row with a Q1 and a Q2 column.
Notes. Several rows can share the same region+quarter — sum them. Every region/quarter combination in the data has at least one row.to_long(df) that melts the wide table into columns student, subject, and score.
Example.
| student | math | science |
|---------|------|---------|
| Alice | 90 | 85 |
becomes rows (Alice, math, 90) and (Alice, science, 85).
Notes. student stays as an identifier column. Every other column becomes a subject value.to_wide(df) that pivots the long table so each student is a row and each subject is its own column holding the score. Turn the student index back into a regular column.
Example. rows (Alice, math, 90) and (Alice, science, 85) collapse to one Alice row with math and science columns.
Notes. Each student-subject pair appears exactly once. Every student has a score for every subject in the data.