File tree 1 file changed +6
-16
lines changed 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -432,23 +432,13 @@ def picker(arr):
432
432
def _try_cast (self , result , obj ):
433
433
""" try to cast the result to our obj original type,
434
434
we may have roundtripped thru object in the mean-time """
435
- try :
436
- if obj .ndim > 1 :
437
- dtype = obj .values .dtype
438
- else :
439
- dtype = obj .dtype
440
-
441
- if _is_numeric_dtype (dtype ):
442
-
443
- # need to respect a non-number here (e.g. Decimal)
444
- if len (result ) and issubclass (type (result [0 ]),(np .number ,float ,int )):
445
- result = _possibly_downcast_to_dtype (result , dtype )
435
+ if obj .ndim > 1 :
436
+ dtype = obj .values .dtype
437
+ else :
438
+ dtype = obj .dtype
446
439
447
- elif issubclass (dtype .type , np .datetime64 ):
448
- if is_datetime64_dtype (obj .dtype ):
449
- result = result .astype (obj .dtype )
450
- except :
451
- pass
440
+ if not np .isscalar (result ):
441
+ result = _possibly_downcast_to_dtype (result , dtype )
452
442
453
443
return result
454
444
You can’t perform that action at this time.
0 commit comments