pandas.api.extensions.ExtensionArray.sort#
- ExtensionArray.sort(*, ascending=True, kind='quicksort', na_position='last')[source]#
Sort the array in-place.
Reorders the elements of the array using
argsort()and writes the sorted result back throughself[:]. Subclasses backed by immutable storage may override this method to raiseNotImplementedError.- Parameters:
- ascendingbool, default True
Whether to sort in ascending order.
- kind{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, default ‘quicksort’
Sorting algorithm.
- na_position{‘first’, ‘last’}, default ‘last’
If ‘first’, put NaN values at the beginning. If ‘last’, put NaN values at the end.
- Returns:
- None
This method mutates the array in place and does not return a value.
See also
ExtensionArray.argsortReturn the indices that would sort this array.
Examples
>>> arr = pd.array([3, 1, 2, 5, 4]) >>> arr.sort() >>> arr <IntegerArray> [1, 2, 3, 4, 5] Length: 5, dtype: Int64