File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -2291,9 +2291,11 @@ def _legal_dtype(series):
2291
2291
legal = dtype == 'O' or (dtype == 'float' and series .isna ().all ())
2292
2292
return legal
2293
2293
err_wrong_dtype = ('Can only concatenate list-likes containing only '
2294
- 'strings (or missing values)' )
2294
+ 'strings (or missing values). ' )
2295
2295
if any (not _legal_dtype (x ) for x in others ):
2296
- raise TypeError (err_wrong_dtype )
2296
+ raise TypeError (err_wrong_dtype + ' Received list-like of dtype: '
2297
+ '{}' .format ([x .dtype for x in others
2298
+ if not _legal_dtype (x )][0 ]))
2297
2299
2298
2300
if join is None and warn :
2299
2301
warnings .warn ("A future version of pandas will perform index "
@@ -2343,9 +2345,12 @@ def _legal_dtype(series):
2343
2345
# no NaNs - can just concatenate
2344
2346
result = cat_core (all_cols , sep )
2345
2347
except TypeError as exc :
2346
- if re .match (r'can only concatenate str \(not \"\w+\"\) to str' ,
2347
- str (exc )):
2348
- raise TypeError (err_wrong_dtype )
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 )))
2349
2354
raise exc
2350
2355
2351
2356
if isinstance (self ._orig , Index ):
You can’t perform that action at this time.
0 commit comments