Skip to content

Commit 892f474

Browse files
committed
perf2?
1 parent cc9ae26 commit 892f474

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/core/strings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ def str_cat_core(array, sep):
5656
if sep == '':
5757
return array.sum(axis=1)
5858
else:
59-
tmp = np.full((array.shape[0], 2 * array.shape[1] - 1),
60-
fill_value=sep, dtype='object')
61-
tmp[:, ::2] = array
62-
return tmp.sum(axis=1)
59+
res = array[:, 0]
60+
for i in range(1, array.shape[1]):
61+
res += sep + array[:, i]
62+
return res
6363

6464

6565
def _na_map(f, arr, na_result=np.nan, dtype=object):

0 commit comments

Comments
 (0)