Skip to content

Cleanup of GroupBy Code #26090

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

Merged
merged 5 commits into from
Apr 16, 2019
Merged
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
34 changes: 0 additions & 34 deletions pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,6 @@ def _cython_agg_general(self, how, alt=None, numeric_only=True,
how, alt=alt, numeric_only=numeric_only, min_count=min_count)
return self._wrap_agged_blocks(new_items, new_blocks)

def _wrap_agged_blocks(self, items, blocks):
obj = self._obj_with_exclusions

new_axes = list(obj._data.axes)

# more kludge
if self.axis == 0:
new_axes[0], new_axes[1] = new_axes[1], self.grouper.result_index
else:
new_axes[self.axis] = self.grouper.result_index

# Make sure block manager integrity check passes.
assert new_axes[0].equals(items)
new_axes[0] = items

mgr = BlockManager(blocks, new_axes)

new_obj = type(obj)(mgr)

return self._post_process_cython_aggregate(new_obj)

_block_agg_axis = 0

def _cython_agg_blocks(self, how, alt=None, numeric_only=True,
Expand Down Expand Up @@ -166,19 +145,6 @@ def _cython_agg_blocks(self, how, alt=None, numeric_only=True,

return new_items, new_blocks

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, arg, *args, **kwargs):

_level = kwargs.pop('_level', None)
Expand Down