Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Index.argsort#

Index.argsort(*args,**kwargs)[source]#

Return the integer indices that would sort the index.

Parameters:
*args

Passed tonumpy.ndarray.argsort.

**kwargs

Passed tonumpy.ndarray.argsort.

Returns:
np.ndarray[np.intp]

Integer indices that would sort the index if used asan indexer.

See also

numpy.argsort

Similar method for NumPy arrays.

Index.sort_values

Return sorted copy of Index.

Examples

>>>idx=pd.Index(['b','a','d','c'])>>>idxIndex(['b', 'a', 'd', 'c'], dtype='object')
>>>order=idx.argsort()>>>orderarray([1, 0, 3, 2])
>>>idx[order]Index(['a', 'b', 'c', 'd'], dtype='object')

[8]ページ先頭

©2009-2025 Movatter.jp