# 077. Wholesale channel assortment

**Question:** How does the median spending mix differ between recorded sales channels?

## Result

The largest computed metric is 1.239e+04 for 2 / grocery; the smallest is 385.5 for 1 / detergents_paper. Metric: median_spend (Source monetary units).

Medians describe a typical customer per category; summing category medians is not a median customer total.

![Wholesale channel assortment](outputs/chart.png)

| channel | category | median_spend | channel_category |
| --- | --- | --- | --- |
| 1 | fresh | 9,582 | 1 / fresh |
| 2 | fresh | 5,994 | 2 / fresh |
| 1 | milk | 2,157 | 1 / milk |
| 2 | milk | 7,812 | 2 / milk |
| 1 | grocery | 2,684 | 1 / grocery |
| 2 | grocery | 1.239e+04 | 2 / grocery |
| 1 | frozen | 2,058 | 1 / frozen |
| 2 | frozen | 1,081 | 2 / frozen |
| 1 | detergents_paper | 385.5 | 1 / detergents_paper |
| 2 | detergents_paper | 5,614 | 2 / detergents_paper |
| 1 | delicassen | 821 | 1 / delicassen |
| 2 | delicassen | 1,350 | 2 / delicassen |

The chart shows 12 of 12 result rows; the table previews the first 12 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

Channel-level medians across six spending categories.

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

Use channel profiles to frame an assortment discussion, then validate with transaction and margin data.

Annual customer spending uses source monetary units, not an assumed currency. There are no margins, transactions or dates. Customer segments are descriptive and do not establish promotion response. 

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/077-wholesale-channel-assortment/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

[Wholesale Customers](https://archive.ics.uci.edu/dataset/292/wholesale+customers), Cardoso (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/wholesale.json) and [prepared-data audit](../../data/provenance/wholesale_prepared.json) record the downloaded files, field coverage and hashes.
