Skip to content

Commit d5470a0

Browse files
committed
Fixed reorder
1 parent 82cad8b commit d5470a0

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

pandas/core/arrays/base.py

+30-29
Original file line numberDiff line numberDiff line change
@@ -276,23 +276,22 @@ def isna(self):
276276
"""
277277
raise AbstractMethodError(self)
278278

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.
282282
283283
Returns
284284
-------
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
294292
"""
295-
return self.astype(object), np.nan
293+
# Note: this is used in `ExtensionArray.argsort`.
294+
return np.array(self)
296295

297296
def argsort(self, ascending=True, kind='quicksort', *args, **kwargs):
298297
"""
@@ -393,6 +392,24 @@ def unique(self):
393392
uniques = unique(self.astype(object))
394393
return self._from_sequence(uniques)
395394

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+
396413
def factorize(self, na_sentinel=-1):
397414
# type: (int) -> Tuple[ndarray, ExtensionArray]
398415
"""Encode the extension array as an enumerated type.
@@ -445,22 +462,6 @@ def factorize(self, na_sentinel=-1):
445462
# ------------------------------------------------------------------------
446463
# Indexing methods
447464
# ------------------------------------------------------------------------
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)
464465

465466
def take(self, indexer, allow_fill=False, fill_value=None):
466467
# type: (Sequence[int], bool, Optional[Any]) -> ExtensionArray

0 commit comments

Comments
 (0)