Divide a array into multiple (individual) arrays based on a bin size in python

Posted by user1492449 on Stack Overflow See other posts from Stack Overflow or by user1492449
Published on 2012-07-01T03:11:26Z Indexed on 2012/07/01 3:15 UTC
Read the original article Hit count: 90

Filed under:

I have an array like this:

-0.68285 -6.919616
-0.7876 -14.521115
-0.64072 -43.428411
-0.05368 -11.561341
-0.43144 -34.768892
-0.23268 -10.793603
-0.22216 -50.341101
-0.41152 -90.083377
-0.01288 -84.265557
-0.3524 -24.253145

How do i split this array into individual arrays based on the value in column 1 with a bin width of 0.1?

i want my output something like this:

array1=[[-0.05368, -11.561341],[-0.01288, -84.265557]]
array2=[[-0.23268, -10.79360] ,[-0.22216, -50.341101]]
array3=[[-0.3524, -24.253145]]
array4=[[-0.43144, -34.768892], [-0.41152, -90.083377]]
array5=[[-0.68285, -6.919616],[-0.64072, -43.428411]]
array6=[[-0.7876, -14.521115]]

© Stack Overflow or respective owner

Related posts about python