# 012. Weather and commute-hour demand

**Question:** How does observed commute-hour demand vary across weather categories and day types?

## Result

The largest computed metric is 421.3 for 1 / weather 1; the smallest is 100 for 1 / weather 4. Metric: mean_rentals (Rentals per observed hour).

Source weather categories are kept as codes. Sample sizes vary; this is a contemporaneous association, not a forecast or causal weather effect.

![Weather and commute-hour demand](outputs/chart.png)

| workingday | weathersit | observed_hours | mean_rentals | median_rentals | group |
| --- | --- | --- | --- | --- | --- |
| 0 | 1 | 956 | 228.1 | 182 | 0 / weather 1 |
| 0 | 2 | 325 | 197.9 | 152 | 0 / weather 2 |
| 0 | 3 | 104 | 120.6 | 85 | 0 / weather 3 |
| 1 | 1 | 1873 | 421.3 | 392 | 1 / weather 1 |
| 1 | 2 | 817 | 364.2 | 329 | 1 / weather 2 |
| 1 | 3 | 292 | 230.2 | 180 | 1 / weather 3 |
| 1 | 4 | 2 | 100 | 100 | 1 / weather 4 |

The chart shows 7 of 7 result rows; the table previews the first 7 in the analysis-defined order. [Download the full result table](outputs/results.csv). Numerical values are computed from the source; missing results stay unavailable.

## Method

Restrict to declared commute hours and stratify by working-day status.

The study uses shared source preparation and reusable statistical routines. Its specific transformations are in [analysis.py](analysis.py), and common model/evaluation code is in [portfolio/methods.py](../../portfolio/methods.py). The [notebook](analysis.ipynb) executes the study and displays the saved results.

## Decision and limitations

Consider weather-aware planning only after obtaining historical forecasts available at decision time.

Historical system rentals measure realized use, not unmet demand or station inventory. Missing hours are unknown. Weather associations do not establish causal effects. 

Related studies may share observations or holdouts. These are focused analytical studies, not independent replications or deployed business systems. Any model refinements informed by these results need new untouched evaluation data. No commercial impact is inferred from an association or backtest.

## Reproduce

From the repository root, after installing `requirements.txt`:

```powershell
python projects/012-weather-and-commute-hour-demand/analysis.py
```

Source data are downloaded automatically if absent. Original archives are retained unchanged and checked by SHA-256. The cleaned cache normalizes column names; field-specific changes are visible in [data preparation](../../portfolio/data.py). Runtime evidence is in [receipt.json](outputs/receipt.json).

## Source

[Bike Sharing](https://archive.ics.uci.edu/dataset/275/bike+sharing+dataset), Fanaee-T (2013). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/bikes.json) and [prepared-data audit](../../data/provenance/bikes_prepared.json) record the downloaded files, field coverage and hashes.
