xorbits.pandas.Index.take#

Index.take(indices, axis: Union[int, Literal['index', 'columns', 'rows']] = 0, allow_fill: bool = True, fill_value=None, **kwargs)[源代码]#

Return a new Index of the values selected by the indices.

For internal compatibility with numpy arrays.

参数
  • indices (array-like) – Indices to be taken.

  • axis (int, optional) – The axis over which to select values, always 0.

  • allow_fill (bool, default True) –

  • fill_value (scalar, default None) – 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.

返回类型

Index

参见

numpy.ndarray.take

Return an array formed from the elements of a at the given indices.

实际案例

>>> idx = pd.Index(['a', 'b', 'c'])  
>>> idx.take([2, 2, 1, 2])  
Index(['c', 'c', 'b', 'c'], dtype='object')

警告

This method has not been implemented yet. Xorbits will try to execute it with pandas.

This docstring was copied from pandas.core.indexes.base.Index.