From 2e0d03a9a104d5ea0579225339002512b694834b Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 2 Dec 2018 13:05:13 +0100 Subject: [PATCH] PERF: Add if branch for empty sep in str.cat --- pandas/core/strings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 54882d039f135..984410d0e580e 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -59,6 +59,8 @@ def cat_core(list_of_columns: List, sep: str): nd.array The concatenation of list_of_columns with sep """ + if sep == '': + return np.sum(list_of_columns, axis=0) list_with_sep = [sep] * (2 * len(list_of_columns) - 1) list_with_sep[::2] = list_of_columns return np.sum(list_with_sep, axis=0)