I have a list, like the following -
a =[9,10,11,11,12,52,49,51,50,55,51,52,54,71,72,70,69,70,110,111,113,114]
As you can see numbers are usually clustered into several points. The cluster can happen anywhere, near 10, or 50, or even 500. There is no uniformity in that. However, they will always be in the range from -5, +5 from the mean of the cluster. Like - int value of mean [9, 10, 11, 11, 12] is 11, and all the numbers in this cluster will be between 6 and 17.
I want to return a new list with the clustered number into sub list - something like -
b =[[9, 10, 11, 11, 12], [49, 50, 51, 51, 52, 52, 54, 55],
[69, 70, 70, 71, 72], [110, 111, 113, 114]]
Is there anyway to answer that?