Project 03 · Regression
When weather meets produce prices
Joining UK weather and weekly produce-price records to test whether a few weather variables explain price movement.
Download notebook ↓ · All projects
Data: 9,647 produce-price rows · 2,191 daily weather rows
Period: 2017–2022
Tools: Python, pandas, scikit-learn, Seaborn, Matplotlib
Question
Do temperature, humidity, or wind speed help explain weekly fruit and vegetable prices in the UK?
Approach
I converted weather records to weekly observations, aligned dates, joined them with produce prices, then tested K-nearest-neighbor and linear-regression models on selected products and weather features.
Align the timelines
Price data is weekly while weather data is daily. The notebook samples the weather series by week and joins on matching dates.
Fit simple baselines
KNN is used for a pear-price exercise; linear regression tests temperature, humidity, and wind speed for selected products.
Read the score with context
R² and mean squared error are useful diagnostics, but they do not show that weather causes the price changes.
Findings and limitations
Observed finding
Weather alone was a weak predictor for apples in the saved runs (R² around 0.02–0.04). Carrot prices had a stronger relationship with temperature in one model (R² 0.33), while humidity was weaker (0.13) and wind speed offered little explanatory value. These are exploratory associations, not causal effects.
What to keep in mind
The two sources have different collection frequencies and are aligned through sampled dates. The simple models omit many potential drivers of price; an apparent change after 2020 cannot be attributed to COVID-19 from this analysis alone.
Next iteration: A stronger model would use a time-aware validation split and add seasonality, variety, supply, and market variables. I would also report uncertainty and compare against a time-series baseline.
Selected figures




Notebook and source data
The notebook preserves the analysis code with saved outputs removed and data paths normalized to a local data folder. Dataset files are not bundled; consult the notebook README and obtain appropriately licensed source data before running it.
- fruitvegprices-2017_2022.csv
- combined_united_kingdom_2017_to_2022.csv (weather source noted as Visual Crossing)