# 078. Customer spending concentration

**Question:** What fraction of aggregate annual spending is associated with the highest-spending customers?

## Result

The largest computed metric is 1 for 1.0; the smallest is 0.06391 for 0.01. Metric: spend_share (Share of annual spending).

No margin or exposure data are supplied; customer concentration is not the same as credit risk.

![Customer spending concentration](outputs/chart.png)

| top_customer_fraction | customers | spend_share |
| --- | --- | --- |
| 0.01 | 5 | 0.06391 |
| 0.05 | 22 | 0.1776 |
| 0.1 | 44 | 0.276 |
| 0.2 | 88 | 0.429 |
| 0.5 | 220 | 0.7442 |
| 1 | 440 | 1 |

The chart shows 6 of 6 result rows; the table previews the first 6 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

Rank customers by total observed spending and compute concentration at fixed top fractions.

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 account-service concentration while avoiding assumptions about profitability.

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/078-customer-spending-concentration/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.
