We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f1f896b commit 3bee5d7Copy full SHA for 3bee5d7
pandas/core/strings.py
@@ -2345,12 +2345,13 @@ def _legal_dtype(series):
2345
# no NaNs - can just concatenate
2346
result = cat_core(all_cols, sep)
2347
except TypeError as exc:
2348
- m = re.match(r'can only concatenate str \(not \"(\w+)\"\) to str',
2349
- str(exc))
2350
- if m:
2351
- raise TypeError(err_wrong_dtype
2352
- + ' Received list-like containing element of'
2353
- + ' type: {}'.format(m.group(1)))
+ if re.match((r'can only concatenate str \(not [\w\"]+) to str'
+ r'|' # different numpy version have...
+ r'Can\'t convert [\w\']+ object to str implicitly'
+ r'|' # ... different error messages in np.sum
+ r'must be str, not \w+'),
+ str(exc)):
2354
+ raise TypeError(err_wrong_dtype)
2355
raise exc
2356
2357
if isinstance(self._orig, Index):
0 commit comments