Return the integer indices that would sort the index. Parameters ---------- *args Passed to `numpy.ndarray.argsort`. **kwargs Passed to `numpy.ndarray.argsort`. Returns ------- np.ndarray[np.intp]
(self, *args, **kwargs)
| 6049 | ) |
| 6050 | |
| 6051 | def argsort(self, *args, **kwargs) -> npt.NDArray[np.intp]: |
| 6052 | """ |
| 6053 | Return the integer indices that would sort the index. |
| 6054 | |
| 6055 | Parameters |
| 6056 | ---------- |
| 6057 | *args |
| 6058 | Passed to `numpy.ndarray.argsort`. |
| 6059 | **kwargs |
| 6060 | Passed to `numpy.ndarray.argsort`. |
| 6061 | |
| 6062 | Returns |
| 6063 | ------- |
| 6064 | np.ndarray[np.intp] |
| 6065 | Integer indices that would sort the index if used as |
| 6066 | an indexer. |
| 6067 | |
| 6068 | See Also |
| 6069 | -------- |
| 6070 | numpy.argsort : Similar method for NumPy arrays. |
| 6071 | Index.sort_values : Return sorted copy of Index. |
| 6072 | |
| 6073 | Examples |
| 6074 | -------- |
| 6075 | >>> idx = pd.Index(["b", "a", "d", "c"]) |
| 6076 | >>> idx |
| 6077 | Index(['b', 'a', 'd', 'c'], dtype='str') |
| 6078 | |
| 6079 | >>> order = idx.argsort() |
| 6080 | >>> order |
| 6081 | array([1, 0, 3, 2]) |
| 6082 | |
| 6083 | >>> idx[order] |
| 6084 | Index(['a', 'b', 'c', 'd'], dtype='str') |
| 6085 | """ |
| 6086 | # This works for either ndarray or EA, is overridden |
| 6087 | # by RangeIndex, MultIIndex |
| 6088 | return self._data.argsort(*args, **kwargs) |
| 6089 | |
| 6090 | def _check_indexing_error(self, key) -> None: |
| 6091 | if not is_scalar(key): |
no outgoing calls