Grouping continuous numbers into bands is one of the most routine things an analyst does: order value bands, age groups, salary slabs, delivery-time buckets. It feels like formatting. It is actually a modelling decision, and we can watch it change a story by working through one small dataset from beginning to end.

The data

Twenty orders from an invented online store, in rupees, sorted: 149, 199, 249, 299, 299, 349, 399, 449, 499, 549, 599, 649, 799, 899, 999, 1,199, 1,499, 2,499, 3,999 and 7,999.

Before grouping anything, compute the plain summary. The mean is ₹1,229. The median is ₹574, the average of the tenth and eleventh values (549 and 599). Those two are already telling us something: the mean is more than double the median, so a few big orders are pulling it up. Keep that in mind.

Attempt one: equal-width bins of ₹500

The default in most tools: bins of equal width starting at zero. Counting the orders in each:

BandOrders
0 to 4999
500 to 9996
1,000 to 1,4992
1,500 to 1,9990
2,000 to 2,4991
Above 2,4992 (₹3,999 and ₹7,999, in separate far-away bins)

The picture: a tall bar on the left and a long thin tail. That is accurate, and it shows the skew. But the tail is the hard part. Bins stretching out to ₹8,000 mean most of the chart is empty space with three or four lonely bars.

Attempt two: shift the edges

Now use bins of ₹400. Same data, only the width has changed. The counts become 7, 6, 3, 1, then single orders sprinkled in the tail (I counted these with a script as well). The shape still says “most orders are small”, but notice that the second bar and third bar have swapped relative sizes compared with attempt one, and the peak is less dramatic: 7 out of 20 rather than 9 out of 20.

The data did not change. The chart did. With real data of thousands of rows the effect is milder, yet with a few hundred rows, or with a very peaky distribution, you can make a hump appear or vanish just by moving an edge. The practical habit: try two or three bin widths before you believe any shape, particularly a second hump that might signal two customer types.

Attempt three: business bands

Reports for managers rarely use equal widths. They use meaningful cut-offs: under ₹300 (below the free-delivery threshold, let us say), ₹300 to ₹999, ₹1,000 to ₹2,999, and ₹3,000 and above. Counts: 5, 10, 3 and 2.

This is more readable and more actionable, since the first band is exactly the orders that do not qualify for free shipping. The cost is that the bands are uneven, so you cannot compare bar heights as if they were equal intervals. If you show a histogram with uneven bins, the height should represent density (count divided by width), not the raw count, or the wide bands will look misleadingly tall. For a table of counts, label the widths clearly.

Also decide the edge rule and write it down. Does ₹300 go in the first band or the second? Is the band “up to and including 299” or “300 and below”? Tools differ on whether the left or right edge is inclusive. A boundary order of exactly ₹1,000 can move between bands depending on a default nobody read.

Attempt four: equal counts

A fourth approach is quantile bands, such that each band has the same number of orders. Sorted, the twenty values split into four groups of five: 149 to 299, 349 to 549, 599 to 999 and 1,199 to 7,999. Their edges follow the data, so skew no longer wastes space, and the top band is honest about being huge and variable (it contains ₹1,199 and ₹7,999 together).

Quantile bands answer “where does an order rank?” well. They are poor for stable reporting, though, because the cut-offs change each month as the data changes. Last month’s “top quartile starts at ₹1,199” may be ₹1,350 this month, and a trend line across the bands means nothing.

Choosing between them

  • Exploring the shape of the data: equal widths, tried at several sizes. For skewed money data consider a log scale, so each bin covers a multiplicative step (100 to 200, 200 to 400, 400 to 800).
  • Reporting to the business: fixed bands that map to decisions such as shipping thresholds or discount tiers, kept the same from month to month.
  • Ranking or scoring customers: quantile bands, with the recalculation rule stated.

One more caution when the binned value goes into a model or a test. Grouping throws away information: an order of ₹999 and one of ₹300 become the same “₹300 to ₹999”. That may be acceptable, but make the choice knowingly, and do not bin a variable only because it is easier to chart.

Figures and names in the examples are illustrative.

Leave a Reply

Trending