I want to slice an array of [x,y] coordinate pairs by x value in Python 3.x, in a similar way to the solution to this question but with coordinates rather than a 1d list.
For example for the (numpy) array of coordinates I want a function like:
coords = np.array([[1.5,10],[2.5,20],[3.5,30],[4.5,40],[5.5,50]])
def slice_coords_by_x(xmin, xmax, arr):
*some function*
slice_coords_by_x(2, 4, arr)
>>>[[2.5,20],[3.5,30]]
Not overly fussy if the solution is inclusive or exclusive of xmin and xmax since i'll be using this over a large range of over 1000 or so.