diff --git a/pandas/_libs/intervaltree.pxi.in b/pandas/_libs/intervaltree.pxi.in index 875848c00311f..f9427fbbcd900 100644 --- a/pandas/_libs/intervaltree.pxi.in +++ b/pandas/_libs/intervaltree.pxi.in @@ -105,7 +105,7 @@ cdef class IntervalTree(IntervalMixin): self.root.query(result, key) if not result.data.n: raise KeyError(key) - return result.to_array() + return result.to_array().astype('intp') def _get_partial_overlap(self, key_left, key_right, side): """Return all positions corresponding to intervals with the given side @@ -155,7 +155,7 @@ cdef class IntervalTree(IntervalMixin): raise KeyError( 'indexer does not intersect a unique set of intervals') old_len = result.data.n - return result.to_array() + return result.to_array().astype('intp') def get_indexer_non_unique(self, scalar_t[:] target): """Return the positions corresponding to intervals that overlap with @@ -175,7 +175,8 @@ cdef class IntervalTree(IntervalMixin): result.append(-1) missing.append(i) old_len = result.data.n - return result.to_array(), missing.to_array() + return (result.to_array().astype('intp'), + missing.to_array().astype('intp')) def __repr__(self): return ('