@@ -1414,10 +1414,12 @@ def infer_dtype(value: object, skipna: bool = True) -> str:
1414
1414
return " time"
1415
1415
1416
1416
elif is_decimal(val):
1417
- return " decimal"
1417
+ if is_decimal_array(values):
1418
+ return " decimal"
1418
1419
1419
1420
elif is_complex(val):
1420
- return " complex"
1421
+ if is_complex_array(values):
1422
+ return " complex"
1421
1423
1422
1424
elif util.is_float_object(val):
1423
1425
if is_float_array(values):
@@ -1702,6 +1704,34 @@ cpdef bint is_float_array(ndarray values):
1702
1704
return validator.validate(values)
1703
1705
1704
1706
1707
+ cdef class ComplexValidator(Validator):
1708
+ cdef inline bint is_value_typed(self , object value) except - 1 :
1709
+ return (
1710
+ util.is_complex_object(value)
1711
+ or (util.is_float_object(value) and is_nan(value))
1712
+ )
1713
+
1714
+ cdef inline bint is_array_typed(self ) except - 1 :
1715
+ return issubclass (self .dtype.type, np.complexfloating)
1716
+
1717
+
1718
+ cdef bint is_complex_array(ndarray values):
1719
+ cdef:
1720
+ ComplexValidator validator = ComplexValidator(len (values), values.dtype)
1721
+ return validator.validate(values)
1722
+
1723
+
1724
+ cdef class DecimalValidator(Validator):
1725
+ cdef inline bint is_value_typed(self , object value) except - 1 :
1726
+ return is_decimal(value)
1727
+
1728
+
1729
+ cdef bint is_decimal_array(ndarray values):
1730
+ cdef:
1731
+ DecimalValidator validator = DecimalValidator(len (values), values.dtype)
1732
+ return validator.validate(values)
1733
+
1734
+
1705
1735
cdef class StringValidator(Validator):
1706
1736
cdef inline bint is_value_typed(self , object value) except - 1 :
1707
1737
return isinstance (value, str )
@@ -2546,8 +2576,6 @@ def fast_multiget(dict mapping, ndarray keys, default=np.nan):
2546
2576
# kludge, for Series
2547
2577
return np.empty(0 , dtype = ' f8' )
2548
2578
2549
- keys = getattr (keys, ' values' , keys)
2550
-
2551
2579
for i in range (n):
2552
2580
val = keys[i]
2553
2581
if val in mapping:
0 commit comments