Skip to content

Commit aaf4ea3

Browse files
h-vetinariquintusdias
authored andcommitted
PERF: Add if branch for empty sep in str.cat (pandas-dev#26605)
1 parent 8eee3b6 commit aaf4ea3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/strings.py

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def cat_core(list_of_columns: List, sep: str):
5959
nd.array
6060
The concatenation of list_of_columns with sep
6161
"""
62+
if sep == "":
63+
# no need to interleave sep if it is empty
64+
return np.sum(list_of_columns, axis=0)
6265
list_with_sep = [sep] * (2 * len(list_of_columns) - 1)
6366
list_with_sep[::2] = list_of_columns
6467
return np.sum(list_with_sep, axis=0)

0 commit comments

Comments
 (0)