@@ -558,7 +558,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
558
558
object
559
559
"""
560
560
561
- dtype = np .object_
561
+ dtype = np .dtype ( np . object_ )
562
562
563
563
# a 1-element ndarray
564
564
if isinstance (val , np .ndarray ):
@@ -577,7 +577,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
577
577
# instead of np.empty (but then you still don't want things
578
578
# coming out as np.str_!
579
579
580
- dtype = np .object_
580
+ dtype = np .dtype ( np . object_ )
581
581
582
582
elif isinstance (val , (np .datetime64 , datetime )):
583
583
val = tslibs .Timestamp (val )
@@ -588,30 +588,30 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
588
588
dtype = DatetimeTZDtype (unit = "ns" , tz = val .tz )
589
589
else :
590
590
# return datetimetz as object
591
- return np .object_ , val
591
+ return np .dtype ( np . object_ ) , val
592
592
val = val .value
593
593
594
594
elif isinstance (val , (np .timedelta64 , timedelta )):
595
595
val = tslibs .Timedelta (val ).value
596
596
dtype = np .dtype ("m8[ns]" )
597
597
598
598
elif is_bool (val ):
599
- dtype = np .bool_
599
+ dtype = np .dtype ( np . bool_ )
600
600
601
601
elif is_integer (val ):
602
602
if isinstance (val , np .integer ):
603
- dtype = type (val )
603
+ dtype = np . dtype ( type (val ) )
604
604
else :
605
- dtype = np .int64
605
+ dtype = np .dtype ( np . int64 )
606
606
607
607
elif is_float (val ):
608
608
if isinstance (val , np .floating ):
609
- dtype = type (val )
609
+ dtype = np . dtype ( type (val ) )
610
610
else :
611
- dtype = np .float64
611
+ dtype = np .dtype ( np . float64 )
612
612
613
613
elif is_complex (val ):
614
- dtype = np .complex_
614
+ dtype = np .dtype ( np . complex_ )
615
615
616
616
elif pandas_dtype :
617
617
if lib .is_period (val ):
0 commit comments