Skip to content

Commit 9761747

Browse files
committed
Review (WillAyd)
1 parent 40124c8 commit 9761747

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pandas/core/strings.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ def cat_core(list_of_columns, sep):
5454
nd.array
5555
The concatenation of list_of_columns with sep
5656
"""
57-
if sep == '':
58-
# no need to add empty strings
59-
return np.sum(list_of_columns, axis=0)
6057
list_with_sep = [sep] * (2 * len(list_of_columns) - 1)
6158
list_with_sep[::2] = list_of_columns
6259
return np.sum(list_with_sep, axis=0)

pandas/tests/test_strings.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ def test_str_cat_align_mixed_inputs(self, join):
367367
with tm.assert_raises_regex(ValueError, rgx):
368368
s.str.cat([t, z], join=join)
369369

370+
def test_str_cat_raises(self):
371+
# non-strings hiding behind object dtype
372+
s = Series([1, 2, 3, 4], dtype='object')
373+
with tm.assert_raises_regex(TypeError, "unsupported operand type.*"):
374+
s.str.cat(s)
375+
370376
def test_str_cat_special_cases(self):
371377
s = Series(['a', 'b', 'c', 'd'])
372378
t = Series(['d', 'a', 'e', 'b'], index=[3, 0, 4, 1])
@@ -3089,7 +3095,7 @@ def test_method_on_bytes(self):
30893095
lhs = Series(np.array(list('abc'), 'S1').astype(object))
30903096
rhs = Series(np.array(list('def'), 'S1').astype(object))
30913097
if compat.PY3:
3092-
pytest.raises(TypeError, lhs.str.cat, rhs, sep=',')
3098+
pytest.raises(TypeError, lhs.str.cat, rhs)
30933099
else:
30943100
result = lhs.str.cat(rhs)
30953101
expected = Series(np.array(

0 commit comments

Comments
 (0)