def _cast(self, val: Any, dtype: pa.DataType) -> Any: """Fix columns with mixed/serialized dtypes""" if not val: return None if is_string(dtype): casted = str(val) elif is_floating(dtype): casted = self._cast_float(val, dtype) elif is_temporal(dtype): casted = self._cast_temporal(val, dtype) else: casted = val return casted
def test_is_floating(): for t in [pa.float16(), pa.float32(), pa.float64()]: assert types.is_floating(t) assert not types.is_floating(pa.int32())
def is_float(arrow_type: DataType, /) -> bool: """Check if data type is float.""" return is_floating(arrow_type) or is_decimal(arrow_type)
def is_float(arrow_type): return is_floating(arrow_type) or is_decimal(arrow_type)