For Supply Chain Analysts ·
What you'll accomplish
By the end of this guide, you'll have a working Python script that builds a statistical demand forecast (exponential smoothing) for your SKUs, calculates forecast error metrics, and outputs a CSV of forecasted demand — using ChatGPT to write and debug the code, no data science degree required.
What you'll need
Export demand history from your ERP as a CSV. You need at minimum:
Example columns: SKU_ID, Week_Ending, Units_Sold
Save it as demand_history.csv.
Go to chatgpt.com and start a new conversation. Paste the following prompt (customized for your data):
I want to build a demand forecast in Python. I have a CSV called demand_history.csv with columns: SKU_ID, Week_Ending (YYYY-MM-DD format), Units_Sold. I have weekly data for the past 2 years.
Build a Python script that:
1. Loads the CSV using pandas
2. For each SKU, fits a Holt-Winters exponential smoothing model (additive seasonality if the data shows it, simple exponential smoothing if not)
3. Forecasts the next 13 weeks of demand for each SKU
4. Calculates MAPE (Mean Absolute Percentage Error) on a held-out 13-week test period to evaluate accuracy
5. Exports a results CSV with columns: SKU_ID, Forecast_Week, Forecasted_Units, Model_MAPE
6. Prints a summary showing average MAPE across all SKUs
Use statsmodels for the exponential smoothing. Include error handling for SKUs with insufficient history (less than 52 weeks).
ChatGPT will produce a complete Python script. Copy it into VS Code or a Jupyter Notebook (.ipynb file). Save as demand_forecast.py.
In your terminal (or VS Code terminal), run:
pip install pandas statsmodels matplotlib
Run the script. If you get errors, copy the error message and paste it into ChatGPT: "I got this error when running the script: [paste error]. How do I fix it?"
ChatGPT will diagnose and provide corrected code.
Open forecast_results.csv in Excel. Review the MAPE values — anything under 20% MAPE is typically acceptable for statistical forecasting. High-MAPE SKUs (above 40%) are candidates for human override.