def _get_val_at(self, loc): n = len(self) if loc < 0: loc += n if loc >= n or loc < 0: raise IndexError('Out of bounds access') sp_loc = self.sp_index.lookup(loc) if sp_loc == -1: return self.fill_value else: return libindex.get_value_at(self, sp_loc)
def _get_val_at(self, loc): n = len(self) if loc < 0: loc += n if loc >= n or loc < 0: raise IndexError('Out of bounds access') sp_loc = self.sp_index.lookup(loc) if sp_loc == -1: return self.fill_value else: # libindex.get_value_at will end up calling __getitem__, # so to avoid recursing we need to unwrap `self` so the # ndarray.__getitem__ implementation is called. return libindex.get_value_at(np.asarray(self), sp_loc)