Why transformation reshapes data for analysis
📖 Scenario: Imagine you have sales data for a small store. The data is messy and hard to analyze because it is not organized well. You want to reshape it so it is easier to see total sales per product and per month.
🎯 Goal: You will reshape the sales data from a list of records into a table format that shows total sales for each product by month. This will help you understand which products sell best in which months.
📋 What You'll Learn
Create a list of dictionaries with sales data including product, month, and sales amount
Create a list of months to use as columns
Use a dictionary comprehension to reshape the data into a nested dictionary with products as keys and monthly sales as values
Print the reshaped data to see the total sales per product per month
💡 Why This Matters
🌍 Real World
Data often comes in messy formats. Reshaping it helps us analyze and understand it better, like seeing sales trends over time.
💼 Career
Data analysts and scientists frequently reshape data to prepare it for reports, dashboards, and decision-making.
Progress0 / 4 steps