@@ -276,23 +276,22 @@ def isna(self):
276
276
"""
277
277
raise AbstractMethodError (self )
278
278
279
- def _values_for_factorize (self ):
280
- # type: () -> Tuple[ ndarray, Any]
281
- """Return an array and missing value suitable for factorization .
279
+ def _values_for_argsort (self ):
280
+ # type: () -> ndarray
281
+ """Return values for sorting .
282
282
283
283
Returns
284
284
-------
285
- values : ndarray
286
- An array suitable for factoraization. This should maintain order
287
- and be a supported dtype (Float64, Int64, UInt64, String, Object).
288
- By default, the extension array is cast to object dtype.
289
- na_value : object
290
- The value in `values` to consider missing. This will be treated
291
- as NA in the factorization routines, so it will be coded as
292
- `na_sentinal` and not included in `uniques`. By default,
293
- ``np.nan`` is used.
285
+ ndarray
286
+ The transformed values should maintain the ordering between values
287
+ within the array.
288
+
289
+ See Also
290
+ --------
291
+ ExtensionArray.argsort
294
292
"""
295
- return self .astype (object ), np .nan
293
+ # Note: this is used in `ExtensionArray.argsort`.
294
+ return np .array (self )
296
295
297
296
def argsort (self , ascending = True , kind = 'quicksort' , * args , ** kwargs ):
298
297
"""
@@ -393,6 +392,24 @@ def unique(self):
393
392
uniques = unique (self .astype (object ))
394
393
return self ._from_sequence (uniques )
395
394
395
+ def _values_for_factorize (self ):
396
+ # type: () -> Tuple[ndarray, Any]
397
+ """Return an array and missing value suitable for factorization.
398
+
399
+ Returns
400
+ -------
401
+ values : ndarray
402
+ An array suitable for factoraization. This should maintain order
403
+ and be a supported dtype (Float64, Int64, UInt64, String, Object).
404
+ By default, the extension array is cast to object dtype.
405
+ na_value : object
406
+ The value in `values` to consider missing. This will be treated
407
+ as NA in the factorization routines, so it will be coded as
408
+ `na_sentinal` and not included in `uniques`. By default,
409
+ ``np.nan`` is used.
410
+ """
411
+ return self .astype (object ), np .nan
412
+
396
413
def factorize (self , na_sentinel = - 1 ):
397
414
# type: (int) -> Tuple[ndarray, ExtensionArray]
398
415
"""Encode the extension array as an enumerated type.
@@ -445,22 +462,6 @@ def factorize(self, na_sentinel=-1):
445
462
# ------------------------------------------------------------------------
446
463
# Indexing methods
447
464
# ------------------------------------------------------------------------
448
- def _values_for_argsort (self ):
449
- # type: () -> ndarray
450
- """Return values for sorting.
451
-
452
- Returns
453
- -------
454
- ndarray
455
- The transformed values should maintain the ordering between values
456
- within the array.
457
-
458
- See Also
459
- --------
460
- ExtensionArray.argsort
461
- """
462
- # Note: this is used in `ExtensionArray.argsort`.
463
- return np .array (self )
464
465
465
466
def take (self , indexer , allow_fill = False , fill_value = None ):
466
467
# type: (Sequence[int], bool, Optional[Any]) -> ExtensionArray
0 commit comments