Return values for sorting.
The transformed values should maintain the ordering between values within the array.
See also
ExtensionArray.argsortReturn the indices that would sort this array.
Notes
The caller is responsible for not modifying these values in-place, so it is safe for implementers to give views on self.
Functions that use this (e.g. ExtensionArray.argsort) should ignore entries with missing values in the original array (according to self.isna()). This means that the corresponding entries in the returned array don’t need to be modified to sort correctly.
Examples
In most cases, this is the underlying Numpy array of the ExtensionArray:
>>> arr = pd.array([1, 2, 3])
>>> arr._values_for_argsort()
array([1, 2, 3])
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.api.extensions.ExtensionArray._values_for_argsort.html