From 324650f146058b617aa1aa06b1be86305d5a4a84 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Sat, 30 Dec 2017 07:37:25 -0600 Subject: [PATCH] DOC: More 0.22.0 updates [ci skip] --- doc/source/whatsnew/v0.21.0.txt | 6 ++++++ doc/source/whatsnew/v0.22.0.txt | 23 +++++++++++++++++++++++ pandas/core/generic.py | 5 ++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt index 89e2d3006696c..3e673bd4cbc28 100644 --- a/doc/source/whatsnew/v0.21.0.txt +++ b/doc/source/whatsnew/v0.21.0.txt @@ -372,6 +372,12 @@ Additionally, support has been dropped for Python 3.4 (:issue:`15251`). Sum/Prod of all-NaN or empty Series/DataFrames is now consistently NaN ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. note:: + + The changes described here have been partially reverted. See + the :ref:`v0.22.0 Whatsnew ` for more. + + The behavior of ``sum`` and ``prod`` on all-NaN Series/DataFrames no longer depends on whether `bottleneck `__ is installed, and return value of ``sum`` and ``prod`` on an empty Series has changed (:issue:`9422`, :issue:`15507`). diff --git a/doc/source/whatsnew/v0.22.0.txt b/doc/source/whatsnew/v0.22.0.txt index da4acd99e3873..d165339cb0de9 100644 --- a/doc/source/whatsnew/v0.22.0.txt +++ b/doc/source/whatsnew/v0.22.0.txt @@ -218,3 +218,26 @@ returns ``0``. The default behavior of ``min_periods=None``, implying that ``min_periods`` equals the window size, is unchanged. + +Compatibility +~~~~~~~~~~~~~ + +If you maintain a library that should work across pandas versions, it +may be easiest to exclude pandas 0.21 from your requirements. Otherwise, all your +``sum()`` calls would need to check if the ``Series`` is empty before summing. + +With setuptools, in your ``setup.py`` use:: + + install_requires=['pandas!=0.21.*', ...] + +With conda, use + +.. code-block:: yaml + + requirements: + run: + - pandas !=0.21.0,!=0.21.1 + +Note that the inconsistency in the return value for all-*NA* series is still +there for pandas 0.20.3 and earlier. Avoiding pandas 0.21 will only help with +the empty case. diff --git a/pandas/core/generic.py b/pandas/core/generic.py index c5359ba2c5ea1..7a0e1fe361c59 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -7534,8 +7534,7 @@ def _doc_parms(cls): ---------- axis : %(axis_descr)s skipna : boolean, default True - Exclude NA/null values. If an entire row/column is NA or empty, the result - will be NA + Exclude NA/null values when computing the result. level : int or level name, default None If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a %(name1)s @@ -7669,7 +7668,7 @@ def _doc_parms(cls): The required number of valid values to perform the operation. If fewer than ``min_count`` non-NA values are present the result will be NA. - .. versionadded :: 0.21.2 + .. versionadded :: 0.22.0 Added with the default being 1. This means the sum or product of an all-NA or empty series is ``NaN``.