Skip to content

Commit

Permalink
PERF: Add if branch for empty sep in str.cat
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jun 1, 2019
1 parent 9a42cbe commit f7bf5ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def cat_core(list_of_columns, sep):
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)
Expand Down

0 comments on commit f7bf5ab

Please sign in to comment.