Skip to content

Commit a198cc8

Browse files
committed
special case series rather than list
1 parent 4ad59d2 commit a198cc8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pandas/_libs/reduction.pyx

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from copy import copy, deepcopy
1+
from copy import copy
22
from distutils.version import LooseVersion
33

44
from cython import Py_ssize_t
@@ -499,11 +499,8 @@ def apply_frame_axis0(object frame, object f, object names,
499499
# `piece` might not have an index, could be e.g. an int
500500
pass
501501

502-
if isinstance(piece, list):
503-
piece = deepcopy(piece)
504-
elif not is_scalar(piece):
505-
# Need to copy data to avoid appending references
506-
if hasattr(piece, "copy"):
502+
if not is_scalar(piece):
503+
if hasattr(piece, "_typ") and piece._typ == "series":
507504
piece = piece.copy(deep="all")
508505
else:
509506
piece = copy(piece)

0 commit comments

Comments
 (0)