• 0

Price brackets from search results


Question

Right, this is confounding me - not necessarily technically but logically.

I have returned a search of products, and one of the things I have brought back is a dataset of prices with a count of products against each.

I have already rounded these up, but can undo that:

Price - Count(Products)

1 - 6

2 - 18

3 - 88

4 - 106

5 - 97

6 - 801

7 - 891

10 - 345

11 - 678

...

5999 - 1

8999 - 1

Not every integer is represented as we may sell no products at that price level. Also the range may be very inconsistent, as demontrated by the single product based at 8999, whereas the median may be in the low hundreds...

OK, follow so far?

What I want to do is write a function that takes these values and displays them in useful brackets. A starting point I was looking at was to simply split the range by 4 and show the products in each quarter - but that is a toss way to do things, as one bracket (the maximum) would contain a single item, it completely ignores the product count per value.

Can someone suggest a logical way to proceed with this?

Thanks

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

How about this:

  1. Find the target number of items per bracket (totalcount/4)
  2. start putting items in the first bracket until target is reached
  3. start putting items in 2nd bracket
  4. etc.. till 4

Link to comment
Share on other sites

  • 0

If I had to do this, I would consider:

1. Get average of all values (this is your halfway mark)

2. Get average of values below halfway mark (this is your 1/4 mark)

3. Get average of values above halfway mark (this is your 3/4 mark)

buckets:

lowest value --> 1/4 bucket mark

1/4 bucket mark --> 1/2 bucket mark

1/2 bucket mark --> 3/4 bucket mark

3/4 bucket mark --> largest value

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.