Skip to content

BUG: fallback from issue 20824 no longer occurs due to skipna flag #26176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,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)
Expand Down Expand Up @@ -144,8 +144,20 @@ def _cython_agg_blocks(self, how, alt=None, numeric_only=True,

return new_items, new_blocks

def aggregate(self, func, *args, **kwargs):
def _get_data_to_aggregate(self):
obj = self._obj_with_exclusions
if self.axis == 0:
return obj.swapaxes(0, 1)._data, 1
else:
return obj._data, self.axis

def _post_process_cython_aggregate(self, obj):
# undoing kludge from below
if self.axis == 0:
obj = obj.swapaxes(0, 1)
return obj

def aggregate(self, func, *args, **kwargs):
_level = kwargs.pop('_level', None)
result, how = self._aggregate(func, _level=_level, *args, **kwargs)
if how is None:
Expand Down