Skip to content

Commit 7d73163

Browse files
committed
Set skipna=True and add section in API breaking
1 parent f094635 commit 7d73163

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

doc/source/whatsnew/v1.0.0.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,27 @@ The following methods now also correctly output values for unobserved categories
235235
df.groupby(["cat_1", "cat_2"], observed=False)["value"].count()
236236
237237
238+
By default :meth:`Categorical.min` and :meth:`Categorical.max` return the min and the max respectively
239+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
240+
241+
When :class:`Categorical` contains ``np.nan``, :meth:`Categorical.min` and :meth:`Categorical.max`
242+
no longer return ``np.nan`` by default.
243+
244+
*pandas 0.25.x*
245+
246+
.. code-block:: ipython
247+
248+
In [1]: pd.Categorical([1, 2, np.nan], ordered=True).min()
249+
Out[1]: nan
250+
251+
252+
*pandas 1.0.0*
253+
254+
.. ipython:: python
255+
256+
pd.Categorical([1, 2, np.nan], ordered=True).min()
257+
258+
238259
.. _whatsnew_1000.api.other:
239260

240261
Other API changes

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,7 @@ def _reduce(self, name, axis=0, **kwargs):
21942194
return func(**kwargs)
21952195

21962196
@deprecate_kwarg(old_arg_name="numeric_only", new_arg_name="skipna")
2197-
def min(self, skipna=None, **kwargs):
2197+
def min(self, skipna=True, **kwargs):
21982198
"""
21992199
The minimum value of the object.
22002200
@@ -2227,7 +2227,7 @@ def min(self, skipna=None, **kwargs):
22272227
return self.categories[pointer]
22282228

22292229
@deprecate_kwarg(old_arg_name="numeric_only", new_arg_name="skipna")
2230-
def max(self, skipna=None, **kwargs):
2230+
def max(self, skipna=True, **kwargs):
22312231
"""
22322232
The maximum value of the object.
22332233

0 commit comments

Comments
 (0)