How to melt an excel budget wide format to long for pandas time-series analysis
- Step 1Identify ID and year columns in the budget — ID columns: Department, Cost Centre. Value columns: Year_2021, Year_2022, Year_2023.
- Step 2Configure and run the unpivot — Set ID columns, value columns, variable name ('Year'), and value name ('Budget_USD').
- Step 3Load into pandas for analysis — pd.read_excel('budget_long.xlsx') gives a DataFrame with Department, Year, Budget_USD columns ready for groupby and plot.
Frequently asked questions
Why not just use pandas.melt() on the original wide file?+
You can — if you're loading the file into pandas anyway. This tool is useful when you want the long-format data in Excel for other tools (Power BI, Tableau) or for sharing with non-Python users.
Does the Year column contain the original column name (e.g. 'Year_2021') or just '2021'?+
The original column name verbatim. If you want just '2021', rename the columns to '2021', '2022', '2023' in the Header Sanitizer before unpivoting.
Can I use the unpivoted output directly with seaborn?+
Yes. sns.lineplot(data=df, x='Year', y='Budget_USD', hue='Department') works perfectly on the long-format output.
Privacy first
Every JAD Excel tool runs entirely in your browser using SheetJS and ExcelJS. Your spreadsheets, formulas, and data never leave your device — verified by zero outbound network requests during processing.