Following code is taken from numpy function base on github
sa = sort(a[i:i+block]) n += np.r_[sa.searchsorted(bins[:-1], \'left\'), sa.searchsorted(bin
What it does is row-wise merging. This post has some nice example:
>>>V = array([1,2,3,4,5,6 ]) >>>Y = array([7,8,9,10,11,12]) >>>np.r_[V[0:2],Y[0],V[3],Y[1:3],V[4:],Y[4:]] array([ 1, 2, 7, 4, 8, 9, 5, 6, 11, 12])
Read more about it in this , and in the documentation of numpy.