Based on my question Fastest way to approximately compare values in large numpy arrays? I was looking for ways to split an array as I wanted. I have a sorted array (2D, sorted by values in one column), and want to split it into multiple arrays. Not of equal length based on index, but of equal range in values. The closest question I found is Split array at value in numpy but I'd like to do something a bit different. Say I have (1D example):
[0.1, 3.5, 6.5, 7.9, 11.4, 12.0, 22.3, 24.5, 26.7, 29.9]
and I want to split it into ranges [0,10) [10,20) [20,30] so it becomes
[0.1, 3.5, 6.5, 7.9] [11.4, 12.0] [22.3, 24.5, 26.7, 29.9]