Return a new Index of the values selected by the indices.
For internal compatibility with numpy arrays.
Indices to be taken.
The axis over which to select values, always 0.
If allow_fill=True and fill_value is not None, indices specified by -1 are regarded as NA. If Index doesn’t hold NA, raise ValueError.
An index formed of elements at the given indices. Will be the same type as self, except for RangeIndex.
See also
numpy.ndarray.takeReturn an array formed from the elements of a at the given indices.
Examples
>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx.take([2, 2, 1, 2])
Index(['c', 'c', 'b', 'c'], dtype='object')
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Index.take.html