Skip to content

Commit 751d500

Browse files
authored
CLN: simplify libreduction (#41542)
1 parent 08314a8 commit 751d500

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pandas/_libs/reduction.pyx

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from copy import copy
21

32
from libc.stdlib cimport (
43
free,
@@ -307,13 +306,11 @@ cpdef inline extract_result(object res):
307306
# Preserve EA
308307
res = res._values
309308
if res.ndim == 1 and len(res) == 1:
309+
# see test_agg_lambda_with_timezone, test_resampler_grouper.py::test_apply
310310
res = res[0]
311-
if hasattr(res, 'values') and is_array(res.values):
312-
res = res.values
313311
if is_array(res):
314-
if res.ndim == 0:
315-
res = res.item()
316-
elif res.ndim == 1 and len(res) == 1:
312+
if res.ndim == 1 and len(res) == 1:
313+
# see test_resampler_grouper.py::test_apply
317314
res = res[0]
318315
return res
319316

@@ -386,7 +383,7 @@ def apply_frame_axis0(object frame, object f, object names,
386383
# Need to infer if low level index slider will cause segfaults
387384
require_slow_apply = i == 0 and piece is chunk
388385
try:
389-
if not piece.index is chunk.index:
386+
if piece.index is not chunk.index:
390387
mutated = True
391388
except AttributeError:
392389
# `piece` might not have an index, could be e.g. an int
@@ -397,7 +394,7 @@ def apply_frame_axis0(object frame, object f, object names,
397394
try:
398395
piece = piece.copy(deep="all")
399396
except (TypeError, AttributeError):
400-
piece = copy(piece)
397+
pass
401398

402399
results.append(piece)
403400

0 commit comments

Comments
 (0)