Skip to content

Commit b3c8834

Browse files
committed
Revert fix for 22722
1 parent 8ff8c32 commit b3c8834

File tree

3 files changed

+1
-22
lines changed

3 files changed

+1
-22
lines changed

doc/source/whatsnew/v0.24.0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ Other API Changes
544544
- :class:`Index` subtraction will attempt to operate element-wise instead of raising ``TypeError`` (:issue:`19369`)
545545
- :class:`pandas.io.formats.style.Styler` supports a ``number-format`` property when using :meth:`~pandas.io.formats.style.Styler.to_excel` (:issue:`22015`)
546546
- :meth:`DataFrame.corr` and :meth:`Series.corr` now raise a ``ValueError`` along with a helpful error message instead of a ``KeyError`` when supplied with an invalid method (:issue:`22298`)
547-
- :meth:`Series.str.cat` now also works for binary data in Python 3 (:issue:`22721`) and has a clearer error message in case of passing non-string columns (:issue:`22722`)
547+
- :meth:`Series.str.cat` now also works for binary data in Python 3 (:issue:`22721`)
548548
- :meth:`shift` will now always return a copy, instead of the previous behaviour of returning self when shifting by 0 (:issue:`22397`)
549549

550550
.. _whatsnew_0240.deprecations:

pandas/core/strings.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,13 +2118,6 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
21182118
'must all be of the same length as the '
21192119
'calling Series/Index.')
21202120

2121-
if any(not is_object_dtype(x)
2122-
and not (is_categorical_dtype(x)
2123-
and is_object_dtype(x.cat.categories))
2124-
for x in others):
2125-
raise TypeError('All columns in others must contain only strings '
2126-
'(or missing values)!')
2127-
21282121
if join is None and warn:
21292122
warnings.warn("A future version of pandas will perform index "
21302123
"alignment when `others` is a Series/Index/"

pandas/tests/test_strings.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,6 @@ def test_str_cat_categorical(self, box, dtype_caller, dtype_target):
195195
result = s.str.cat(t)
196196
assert_series_or_index_equal(result, expected)
197197

198-
# errors for inputs not consisting of strings (also when categorical)
199-
rgx = 'All columns in others must contain only strings.*'
200-
201-
# data with non-object dtype
202-
with tm.assert_raises_regex(TypeError, rgx):
203-
s.str.cat(Series([1, 2, 3, 4]))
204-
205198
@pytest.mark.parametrize('box', [Series, Index])
206199
def test_str_cat_mixed_inputs(self, box):
207200
s = Index(['a', 'b', 'c', 'd'])
@@ -312,13 +305,6 @@ def test_str_cat_mixed_inputs(self, box):
312305
with tm.assert_raises_regex(TypeError, rgx):
313306
s.str.cat(1)
314307

315-
# errors for inputs not consisting of strings
316-
rgx = 'All columns in others must contain only strings.*'
317-
318-
# data with non-object dtype
319-
with tm.assert_raises_regex(TypeError, rgx):
320-
s.str.cat(Series([1, 2, 3, 4]))
321-
322308
@pytest.mark.parametrize('join', ['left', 'outer', 'inner', 'right'])
323309
@pytest.mark.parametrize('box', [Series, Index])
324310
def test_str_cat_align_indexed(self, box, join):

0 commit comments

Comments
 (0)