Skip to content

Commit d270178

Browse files
committed
One more round of review
1 parent 08593e0 commit d270178

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pandas/core/strings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,8 +1966,13 @@ def _get_series_list(self, others, ignore_index=False):
19661966
'list-like (either containing only strings or containing '
19671967
'only objects of type Series/Index/list-like/np.ndarray)')
19681968

1969+
# Generally speaking, all objects without an index inherit the index
1970+
# `idx` of the calling Series/Index - i.e. must have matching length.
1971+
# Objects with an index (i.d. Series/Index/DataFrame) keep their own
1972+
# index, *unless* ignore_index is set to True.
19691973
if isinstance(others, Series):
19701974
warn = not others.index.equals(idx)
1975+
# only reconstruct Series when absolutely necessary
19711976
los = [Series(others.values, index=idx)
19721977
if ignore_index and warn else others]
19731978
return (los, warn)

0 commit comments

Comments
 (0)