Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test
  • Loading branch information
phofl committed Dec 17, 2022
commit bf1412e63f406f3d4bef7d4f28e627e1dfcc526c
3 changes: 3 additions & 0 deletions pandas/core/arrays/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ def _coerce_to_data_and_mask(values, mask, dtype, copy, dtype_cls, default_dtype
inferred_type = None
if is_object_dtype(values.dtype) or is_string_dtype(values.dtype):
inferred_type = lib.infer_dtype(values, skipna=True)
if inferred_type == "boolean" and dtype is None:
name = dtype_cls.__name__.strip("_")
raise TypeError(f"{values.dtype} cannot be converted to {name}")

elif is_bool_dtype(values) and checker(dtype):
values = np.array(values, dtype=default_dtype, copy=copy)
Expand Down