We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed27c66 commit 0d3c6d2Copy full SHA for 0d3c6d2
pandas/core/strings.py
@@ -54,9 +54,6 @@ def cat_core(list_of_columns, sep):
54
nd.array
55
The concatenation of list_of_columns with sep
56
"""
57
- if sep == '':
58
- # no need to add empty strings
59
- return np.sum(list_of_columns, axis=0)
60
list_with_sep = [sep] * (2 * len(list_of_columns) - 1)
61
list_with_sep[::2] = list_of_columns
62
return np.sum(list_with_sep, axis=0)
pandas/tests/test_strings.py
@@ -367,6 +367,12 @@ def test_str_cat_align_mixed_inputs(self, join):
367
with tm.assert_raises_regex(ValueError, rgx):
368
s.str.cat([t, z], join=join)
369
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
+
376
def test_str_cat_special_cases(self):
377
s = Series(['a', 'b', 'c', 'd'])
378
t = Series(['d', 'a', 'e', 'b'], index=[3, 0, 4, 1])
@@ -3089,7 +3095,7 @@ def test_method_on_bytes(self):
3089
3095
lhs = Series(np.array(list('abc'), 'S1').astype(object))
3090
3096
rhs = Series(np.array(list('def'), 'S1').astype(object))
3091
3097
if compat.PY3:
3092
- pytest.raises(TypeError, lhs.str.cat, rhs, sep=',')
3098
+ pytest.raises(TypeError, lhs.str.cat, rhs)
3093
3099
else:
3094
3100
result = lhs.str.cat(rhs)
3101
expected = Series(np.array(
0 commit comments