From 5ab1fe403c731c463731dc16596a96843f9c38f1 Mon Sep 17 00:00:00 2001 From: Mukund Manikantan Date: Sun, 21 Apr 2019 15:36:34 -0400 Subject: [PATCH 1/3] BUG: Resolving fallback from skipna flag in groupby().sum() --- doc/source/whatsnew/v0.25.0.rst | 1 + pandas/core/groupby/generic.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.25.0.rst b/doc/source/whatsnew/v0.25.0.rst index fe047b4a141ef..7e545ec1ccafc 100644 --- a/doc/source/whatsnew/v0.25.0.rst +++ b/doc/source/whatsnew/v0.25.0.rst @@ -383,6 +383,7 @@ Groupby/Resample/Rolling - Ensured that result group order is correct when grouping on an ordered ``Categorical`` and specifying ``observed=True`` (:issue:`25871`, :issue:`25167`) - Bug in :meth:`pandas.core.window.Rolling.min` and :meth:`pandas.core.window.Rolling.max` that caused a memory leak (:issue:`25893`) - Bug in :func:`idxmax` and :func:`idxmin` on :meth:`DataFrame.groupby` with datetime column would return incorrect dtype (:issue:`25444`, :issue:`15306`) +- Bug in :func:`_cython_agg_general` which caused a fall back in line 1272 of groupby.py, fixed by adding optional skipna flag in :func:`_cython_agg_general`. Fallback still occurs from strings but this comes from :func:`_aggregate` in groupby/ops.py Reshaping ^^^^^^^^^ diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index b6fc31bb6f015..2ff21dd6fab0f 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -64,7 +64,7 @@ def _iterate_slices(self): yield val, slicer(val) def _cython_agg_general(self, how, alt=None, numeric_only=True, - min_count=-1): + min_count=-1, skipna=True): new_items, new_blocks = self._cython_agg_blocks( how, alt=alt, numeric_only=numeric_only, min_count=min_count) return self._wrap_agged_blocks(new_items, new_blocks) From cec1e4e07efa305a2df170af4a3d780547ab1d64 Mon Sep 17 00:00:00 2001 From: mukundm19 Date: Sun, 21 Apr 2019 19:18:19 -0400 Subject: [PATCH 2/3] DOC: removing update to v0.25.0.rst Removing whatsnew entry; not user facing. --- doc/source/whatsnew/v0.25.0.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/whatsnew/v0.25.0.rst b/doc/source/whatsnew/v0.25.0.rst index 40e8653c38048..1f030d5416468 100644 --- a/doc/source/whatsnew/v0.25.0.rst +++ b/doc/source/whatsnew/v0.25.0.rst @@ -390,7 +390,6 @@ Groupby/Resample/Rolling - Bug in :func:`idxmax` and :func:`idxmin` on :meth:`DataFrame.groupby` with datetime column would return incorrect dtype (:issue:`25444`, :issue:`15306`) - Bug in :meth:`pandas.core.groupby.GroupBy.idxmax` and :meth:`pandas.core.groupby.GroupBy.idxmin` with datetime column would return incorrect dtype (:issue:`25444`, :issue:`15306`) - Bug in :meth:`pandas.core.groupby.GroupBy.cumsum`, :meth:`pandas.core.groupby.GroupBy.cumprod`, :meth:`pandas.core.groupby.GroupBy.cummin` and :meth:`pandas.core.groupby.GroupBy.cummax` with categorical column having absent categories, would return incorrect result or segfault (:issue:`16771`) -- Bug in :func:`_cython_agg_general` which caused a fall back in line 1272 of groupby.py, fixed by adding optional skipna flag in :func:`_cython_agg_general`. Fallback still occurs from strings but this comes from :func:`_aggregate` in groupby/ops.py Reshaping ^^^^^^^^^ From e8c93fb50e4e496484096b2a7ffe5ee539788e7e Mon Sep 17 00:00:00 2001 From: mukundm19 Date: Sun, 21 Apr 2019 19:54:52 -0400 Subject: [PATCH 3/3] DOC: updating whatsnew v0.25.0.rst Removing text unintentionally added while resolving conflict --- doc/source/whatsnew/v0.25.0.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/whatsnew/v0.25.0.rst b/doc/source/whatsnew/v0.25.0.rst index 1f030d5416468..c25bc87a00d2e 100644 --- a/doc/source/whatsnew/v0.25.0.rst +++ b/doc/source/whatsnew/v0.25.0.rst @@ -387,7 +387,6 @@ Groupby/Resample/Rolling - Ensured that ordering of outputs in ``groupby`` aggregation functions is consistent across all versions of Python (:issue:`25692`) - Ensured that result group order is correct when grouping on an ordered ``Categorical`` and specifying ``observed=True`` (:issue:`25871`, :issue:`25167`) - Bug in :meth:`pandas.core.window.Rolling.min` and :meth:`pandas.core.window.Rolling.max` that caused a memory leak (:issue:`25893`) -- Bug in :func:`idxmax` and :func:`idxmin` on :meth:`DataFrame.groupby` with datetime column would return incorrect dtype (:issue:`25444`, :issue:`15306`) - Bug in :meth:`pandas.core.groupby.GroupBy.idxmax` and :meth:`pandas.core.groupby.GroupBy.idxmin` with datetime column would return incorrect dtype (:issue:`25444`, :issue:`15306`) - Bug in :meth:`pandas.core.groupby.GroupBy.cumsum`, :meth:`pandas.core.groupby.GroupBy.cumprod`, :meth:`pandas.core.groupby.GroupBy.cummin` and :meth:`pandas.core.groupby.GroupBy.cummax` with categorical column having absent categories, would return incorrect result or segfault (:issue:`16771`)