def _convert_types(values, na_values): try: values = lib.maybe_convert_numeric(values, na_values) except Exception: lib.sanitize_objects(values, na_values) if values.dtype == np.object_: return lib.maybe_convert_bool(values) return values
def _convert_types(values, na_values): if issubclass(values.dtype.type, (np.number, np.bool_)): return values try: values = lib.maybe_convert_numeric(values, na_values) except Exception: lib.sanitize_objects(values, na_values) if values.dtype == np.object_: return lib.maybe_convert_bool(values) return values
def _convert_types(values, na_values): na_count = 0 if issubclass(values.dtype.type, (np.number, np.bool_)): return values, na_count try: result = lib.maybe_convert_numeric(values, na_values) except Exception: na_count = lib.sanitize_objects(values, na_values) result = values if result.dtype == np.object_: result = lib.maybe_convert_bool(values) return result, na_count
def _convert_types(values, na_values): na_count = 0 if issubclass(values.dtype.type, (np.number, np.bool_)): mask = lib.ismember(values, na_values) na_count = mask.sum() if na_count > 0: if com.is_integer_dtype(values): values = values.astype(np.float64) np.putmask(values, mask, np.nan) return values, na_count try: result = lib.maybe_convert_numeric(values, na_values) except Exception: na_count = lib.sanitize_objects(values, na_values) result = values if result.dtype == np.object_: result = lib.maybe_convert_bool(values) return result, na_count