take#

NestedExtensionArray.take(indices, *, allow_fill: bool = False, fill_value: Any = None) Self[source]#

Take elements from an array.

Parameters:
  • indices (sequence of int or one-dimensional np.ndarray of int) – 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 negative values raise a ValueError.

  • fill_value (any, optional) – Fill value to use for NA-indices when allow_fill is True. This may be None, in which case pd.NA is used.

Return type:

NestedExtensionArray

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.