11. Reshape and Wide/Long Data
11.1 Wide vs Long
Wide: one row per city, many month columns. Long: one row per city-month — better for groupby and seaborn.
import pandas as pd
wide = pd.DataFrame({
"city": ["Pune", "Nashik", "Nagpur"],
"Aug": [120000, 80000, 70000],
"Sep": [150000, 95000, 72000], # Ganeshotsav lift in Pune
"Oct": [220000, 140000, 90000], # Diwali lift
})
wide