Refund rate by product category
A rate, computed from the flag rather than counted twice: the mean of a boolean is the share that are true.
How it decided
Sales orders: 11,316 rows, 10 columns. category and the refunded flag. Amounts are irrelevant to a rate.
11,316 rows in, 5 out across 2 columns. A rate, computed from the flag rather than counted twice: the mean of a boolean is the share that are true.
hbar. Category names are long, so the bars run horizontally and the labels stay readable rather than rotating.
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.
result = df.groupby("category", as_index=False)["refunded"].mean()
result["refund_rate"] = result["refunded"] * 100
result = result[["category", "refund_rate"]].sort_values("refund_rate", ascending=False)
What it charted
5 rows out of 11,316, 2 columns. First 5 shown.
| category | refund_rate |
|---|---|
| Support | 3.8613 |
| Services | 3.5011 |
| Software | 3.2459 |
| Hardware | 2.4793 |
| Training | 2.4047 |