Measurements ranked by spread between cultivars
Each measurement is scored by how far the cultivar means spread relative to the overall mean, so measures on wildly different units can be ranked against each other.
How it decided
Wine recognition: 178 rows, 14 columns. every numeric column, grouped by cultivar.
178 rows in, 8 out across 2 columns. Each measurement is scored by how far the cultivar means spread relative to the overall mean, so measures on wildly different units can be ranked against each other.
hbar. A ranking of long-named things is a horizontal bar chart. The top eight are shown because the tail carries no signal.
Palette, spacing, axis titles and legend placement applied. 0 issues found.
The transformation
This is the code, not a description of it — the chart above was drawn from what it returns, and the notebook download runs the same lines against the same file.
means = df.groupby("cultivar").mean(numeric_only=True)
spread = (means.max() - means.min()) / means.mean().abs()
result = (
spread.sort_values(ascending=False).head(8)
.rename("relative_spread").reset_index()
.rename(columns={"index": "measurement"})
)
What it charted
8 rows out of 178, 2 columns. First 8 shown.
| measurement | relative_spread |
|---|---|
| flavanoids | 1.1297 |
| color_intensity | 0.8075 |
| proline | 0.7896 |
| od280/od315_of_diluted_wines | 0.5799 |
| malic_acid | 0.5776 |
| total_phenols | 0.5141 |
| proanthocyanins | 0.4777 |
| nonflavanoid_phenols | 0.4291 |