You are almost there. It's just that numpy.record (this is what I suppose you used, given the error message you received) is actually not what you want; just create an array of records from one element:
>>> a_b = numpy.rec.fromarrays((a, b)) >>> a_b rec.array([(0, 1), (0, 2), (1, 1), (1, 2), (2, 1), (3, 4), (3, 7), (3, 9), (4, 4), (4, 8), (5, 1), (6, 1)], dtype=[('f0', '<i8'), ('f1', '<i8')]) >>> numpy.searchsorted(a_b, numpy.array((3, 7), dtype=a_b.dtype)) 6
It may also be useful to know that sort and argsort sort arrays of records lexically as well as lexsort . Example using lexsort :
>>> random_idx = numpy.random.permutation(range(12)) >>> a = numpy.array(a)[random_idx] >>> b = numpy.array(b)[random_idx] >>> sorted_idx = numpy.lexsort((b, a)) >>> a[sorted_idx] array([0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 6]) >>> b[sorted_idx] array([1, 2, 1, 2, 1, 4, 7, 9, 4, 8, 1, 1])
Sorting record arrays:
>>> a_b = numpy.rec.fromarrays((a, b)) >>> a_b[a_b.argsort()] rec.array([(0, 1), (0, 2), (1, 1), (1, 2), (2, 1), (3, 4), (3, 7), (3, 9), (4, 4), (4, 8), (5, 1), (6, 1)], dtype=[('f0', '<i8'), ('f1', '<i8')]) >>> a_b.sort() >>> a_b rec.array([(0, 1), (0, 2), (1, 1), (1, 2), (2, 1), (3, 4), (3, 7), (3, 9), (4, 4), (4, 8), (5, 1), (6, 1)], dtype=[('f0', '<i8'), ('f1', '<i8')])