Table Of Contents

Search

Enter search terms or a module, class or function name.

pandas.arrays.IntervalArray.take

IntervalArray.take(indices, allow_fill=False, fill_value=None, axis=None, **kwargs)[source]

Take elements from the IntervalArray.

Parameters:
indices : sequence of integers

Indices to be taken.

allow_fill : bool, default False

How to handle negative values in indices.

  • False: negative values in indices indicate positional indices from the right (the default). This is similar to numpy.take().
  • True: negative values in indices indicate missing values. These values are set to fill_value. Any other other negative values raise a ValueError.
fill_value : Interval or NA, optional

Fill value to use for NA-indices when allow_fill is True. This may be None, in which case the default NA value for the type, self.dtype.na_value, is used.

For many ExtensionArrays, there will be two representations of fill_value: a user-facing “boxed” scalar, and a low-level physical NA value. fill_value should be the user-facing version, and the implementation should handle translating that to the physical version for processing the take if necessary.

axis : any, default None

Present for compat with IntervalIndex; does nothing.

Returns:
IntervalArray
Raises:
IndexError

When the indices are out of bounds for the array.

ValueError

When indices contains negative values other than -1 and allow_fill is True.

Scroll To Top