pandas.api.extensions.ExtensionArray._values_for_argsort#

ExtensionArray._values_for_argsort()[source]#

Return values for sorting.

Returns:
ndarray

The transformed values should maintain the ordering between values within the array.

See also

ExtensionArray.argsort

Return 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])