Skip to content

Commit 088b494

Browse files
committedNov 9, 2021
moving whatsnew note to notable fixes
1 parent e3fd597 commit 088b494

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed
 

‎doc/source/whatsnew/v1.4.0.rst

+32-1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,38 @@ Now the float-dtype is respected. Since the common dtype for these DataFrames is
240240

241241
*New behavior*:
242242

243+
.. ipython:: python
244+
245+
res
246+
247+
.. _whatsnew_140.notable_bug_fixes.value_counts_and_mode_do_not_coerse_to_nan:
248+
249+
Null-values are no longer coerced to NaN-value in value_counts and mode
250+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
251+
252+
:meth:`Series.value_counts` and :meth:`Series.mode` no longer coerce ``None``, ``NaT`` and other null-values to a NaN-value for ``np.object``-dtype. This behavior is now consistent with ``unique``, ``isin`` and others (:issue:`42688`).
253+
254+
.. ipython:: python
255+
256+
s = pd.Series([True, None, pd.NaT, None, pd.NaT, None])
257+
res = s.value_counts(dropna=False)
258+
259+
Previously, all null-values were replaced by a NaN-value.
260+
261+
*Previous behavior*:
262+
263+
.. code-block:: ipython
264+
265+
In [3]: res
266+
Out[3]:
267+
NaN 5
268+
True 1
269+
dtype: int64
270+
271+
Now null-values are no longer mangled.
272+
273+
*New behavior*:
274+
243275
.. ipython:: python
244276
245277
res
@@ -549,7 +581,6 @@ Missing
549581
^^^^^^^
550582
- Bug in :meth:`DataFrame.fillna` with limit and no method ignores axis='columns' or ``axis = 1`` (:issue:`40989`)
551583
- Bug in :meth:`DataFrame.fillna` not replacing missing values when using a dict-like ``value`` and duplicate column names (:issue:`43476`)
552-
- :meth:`Series.value_counts` and :meth:`Series.mode` no longer coerce ``None``, ``NaT`` and other null-values to a NaN-value for ``np.object``-dtype. This behavior is now consistent with ``unique``, ``isin`` and others (:issue:`42688`)
553584
-
554585

555586
MultiIndex

0 commit comments

Comments
 (0)