Skip to content

CLN: remove unused args/kwargs in BlockManager.reduce #34818

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
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
8 changes: 4 additions & 4 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,24 +327,24 @@ def _verify_integrity(self) -> None:
f"tot_items: {tot_items}"
)

def reduce(self, func, *args, **kwargs):
def reduce(self, func):
# If 2D, we assume that we're operating column-wise
if self.ndim == 1:
# we'll be returning a scalar
blk = self.blocks[0]
return func(blk.values, *args, **kwargs)
return func(blk.values)

res = {}
for blk in self.blocks:
bres = func(blk.values, *args, **kwargs)
bres = func(blk.values)

if np.ndim(bres) == 0:
# EA
assert blk.shape[0] == 1
new_res = zip(blk.mgr_locs.as_array, [bres])
else:
assert bres.ndim == 1, bres.shape
assert blk.shape[0] == len(bres), (blk.shape, bres.shape, args, kwargs)
assert blk.shape[0] == len(bres), (blk.shape, bres.shape)
new_res = zip(blk.mgr_locs.as_array, bres)

nr = dict(new_res)
Expand Down