@@ -237,31 +237,21 @@ def isna(self):
237
237
"""
238
238
raise AbstractMethodError (self )
239
239
240
- def _simple_ndarray (self ):
240
+ def _values_for_argsort (self ):
241
241
# type: () -> ndarray
242
- """Convert the array to a simple ndarray representaiton.
243
-
244
- Many methods can operate indirectly on a cheap-to-compute array that
245
- is somehow representative of the extension array. For example, rather
246
- than sorting an ExtensionArray directly, which might be expensive,
247
- we could convert the ExtensionArray to a representative ndarray of
248
- integers, sort the integers, and perform a ``take``.
249
-
250
- The coversion between ExtensionArray and the simple ndarray should be
251
- strictly monotonic https://en.wikipedia.org/wiki/Monotonic_function,
252
- and as cheap to compute as possible.
242
+ """Return values for sorting.
253
243
254
244
Returns
255
245
-------
256
- values : ndarray
246
+ ndarray
247
+ The transformed values should maintain the ordering between values
248
+ within the array.
257
249
258
250
See Also
259
251
--------
260
252
ExtensionArray.argsort
261
253
"""
262
- # Implemnetor note: This method is currently used in
263
- # - ExtensionArray.argsort
264
-
254
+ # Note: this is used in `ExtensionArray.argsort`.
265
255
return np .array (self )
266
256
267
257
def argsort (self , ascending = True , kind = 'quicksort' , * args , ** kwargs ):
@@ -289,11 +279,10 @@ def argsort(self, ascending=True, kind='quicksort', *args, **kwargs):
289
279
"""
290
280
# Implementor note: You have two places to override the behavior of
291
281
# argsort.
292
- # 1. _simple_ndarray : construct the values passed to np.argsort
282
+ # 1. _values_for_argsort : construct the values passed to np.argsort
293
283
# 2. argsort : total control over sorting.
294
-
295
284
ascending = nv .validate_argsort_with_ascending (ascending , args , kwargs )
296
- values = self ._simple_ndarray ()
285
+ values = self ._values_for_argsort ()
297
286
result = np .argsort (values , kind = kind , ** kwargs )
298
287
if not ascending :
299
288
result = result [::- 1 ]
0 commit comments