@@ -2123,7 +2123,8 @@ def _reduce(self, name, axis=0, **kwargs):
21232123 raise TypeError (f"Categorical cannot perform the operation { name } " )
21242124 return func (** kwargs )
21252125
2126- def min (self , numeric_only = None , ** kwargs ):
2126+ @deprecate_kwarg (old_arg_name = "numeric_only" , new_arg_name = "skipna" )
2127+ def min (self , skipna = True ):
21272128 """
21282129 The minimum value of the object.
21292130
@@ -2139,17 +2140,18 @@ def min(self, numeric_only=None, **kwargs):
21392140 min : the minimum of this `Categorical`
21402141 """
21412142 self .check_for_ordered ("min" )
2142- if numeric_only :
2143- good = self ._codes != - 1
2144- pointer = self ._codes [good ].min (** kwargs )
2145- else :
2146- pointer = self ._codes .min (** kwargs )
2147- if pointer == - 1 :
2148- return np .nan
2143+ good = self ._codes != - 1
2144+ if not good .all ():
2145+ if skipna :
2146+ pointer = self ._codes [good ].min ()
2147+ else :
2148+ return np .nan
21492149 else :
2150- return self .categories [pointer ]
2150+ pointer = self ._codes .min ()
2151+ return self .categories [pointer ]
21512152
2152- def max (self , numeric_only = None , ** kwargs ):
2153+ @deprecate_kwarg (old_arg_name = "numeric_only" , new_arg_name = "skipna" )
2154+ def max (self , skipna = True ):
21532155 """
21542156 The maximum value of the object.
21552157
@@ -2165,15 +2167,15 @@ def max(self, numeric_only=None, **kwargs):
21652167 max : the maximum of this `Categorical`
21662168 """
21672169 self .check_for_ordered ("max" )
2168- if numeric_only :
2169- good = self ._codes != - 1
2170- pointer = self ._codes [good ].max (** kwargs )
2171- else :
2172- pointer = self ._codes .max (** kwargs )
2173- if pointer == - 1 :
2174- return np .nan
2170+ good = self ._codes != - 1
2171+ if not good .all ():
2172+ if skipna :
2173+ pointer = self ._codes [good ].max ()
2174+ else :
2175+ return np .nan
21752176 else :
2176- return self .categories [pointer ]
2177+ pointer = self ._codes .max ()
2178+ return self .categories [pointer ]
21772179
21782180 def mode (self , dropna = True ):
21792181 """
0 commit comments