Skip to content

Commit fdd7e45

Browse files
committed
DOC: update the pd.Index.argsort docstring
1 parent c3d491a commit fdd7e45

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

pandas/core/indexes/base.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,16 +2316,31 @@ def shift(self, periods=1, freq=None):
23162316

23172317
def argsort(self, *args, **kwargs):
23182318
"""
2319-
Returns the indices that would sort the index and its
2320-
underlying data.
2319+
Return the order of the indices.
2320+
2321+
We have an object with values and index. Using argsort method
2322+
returns a series of indices that would sort the index.
2323+
2324+
Parameters
2325+
----------
2326+
*args
2327+
Passed to `numpy.ndarray.argsort`.
2328+
**kwargs
2329+
Passed to `numpy.ndarray.argsort`.
23212330
23222331
Returns
23232332
-------
2324-
argsorted : numpy array
2333+
numpy.ndarray : Argsorted indices of the index
23252334
23262335
See also
23272336
--------
2328-
numpy.ndarray.argsort
2337+
numpy.ndarray.argsort : Returns the indices that would sort this array.
2338+
2339+
Examples
2340+
--------
2341+
>>> s = pd.Series(data=[4,3,2,1],index=['c','b','a','d'])
2342+
>>> s.index.argsort()
2343+
array([2, 1, 0, 3], dtype=int64)
23292344
"""
23302345
result = self.asi8
23312346
if result is None:

0 commit comments

Comments
 (0)