Long to wide with pivot
A pandas exercise from Pandasdrill. Solve it with a Python editor in your browser running real pandas, and it is checked the moment you submit.
The task
Reshape `long` into a table with one row per store and one column per quarter, holding the sales values.
What this exercise teaches
pivot is the reverse of melt. It needs each store and quarter pair to appear once, and it sorts the new index and columns.
A hint if you get stuck
pivot takes index (new rows), columns (new columns) and values (what fills the cells).
This exercise is part of Pro
Pro unlocks all 45 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.
You create a free account first, so Pro is attached to it.
Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.