@@ -180,7 +180,7 @@ class ExtensionArray:
180180 * dropna
181181 * unique
182182 * factorize / _values_for_factorize
183- * argsort / _values_for_argsort
183+ * argsort, argmax, argmin / _values_for_argsort
184184 * searchsorted
185185
186186 The remaining methods implemented on this class should be performant,
@@ -639,7 +639,7 @@ def _values_for_argsort(self) -> np.ndarray:
639639 This means that the corresponding entries in the returned array don't need to
640640 be modified to sort correctly.
641641 """
642- # Note: this is used in `ExtensionArray.argsort`.
642+ # Note: this is used in `ExtensionArray.argsort/argmin/argmax `.
643643 return np .array (self )
644644
645645 def argsort (
@@ -676,7 +676,8 @@ def argsort(
676676 # Implementor note: You have two places to override the behavior of
677677 # argsort.
678678 # 1. _values_for_argsort : construct the values passed to np.argsort
679- # 2. argsort : total control over sorting.
679+ # 2. argsort : total control over sorting. In case of overriding this,
680+ # it is recommended to also override argmax/argmin
680681 ascending = nv .validate_argsort_with_ascending (ascending , args , kwargs )
681682
682683 values = self ._values_for_argsort ()
@@ -707,6 +708,10 @@ def argmin(self, skipna: bool = True) -> int:
707708 --------
708709 ExtensionArray.argmax
709710 """
711+ # Implementor note: You have two places to override the behavior of
712+ # argmin.
713+ # 1. _values_for_argsort : construct the values used in nargminmax
714+ # 2. argmin itself : total control over sorting.
710715 validate_bool_kwarg (skipna , "skipna" )
711716 if not skipna and self ._hasna :
712717 raise NotImplementedError
@@ -731,6 +736,10 @@ def argmax(self, skipna: bool = True) -> int:
731736 --------
732737 ExtensionArray.argmin
733738 """
739+ # Implementor note: You have two places to override the behavior of
740+ # argmax.
741+ # 1. _values_for_argsort : construct the values used in nargminmax
742+ # 2. argmax itself : total control over sorting.
734743 validate_bool_kwarg (skipna , "skipna" )
735744 if not skipna and self ._hasna :
736745 raise NotImplementedError
0 commit comments