Skip to content

Commit 0c97445

Browse files
committed
BUG: support casting from bool array to EA Integer dtype
Fixes pandas-dev#25211. Cast boolean array to int before casting to EA Integer dtype.
1 parent 5f73594 commit 0c97445

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/arrays/integer.py

+3
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ def coerce_to_array(values, dtype, mask=None, copy=False):
187187
raise TypeError("{} cannot be converted to an IntegerDtype".format(
188188
values.dtype))
189189

190+
elif is_bool_dtype(values):
191+
values = np.array(values, dtype=int, copy=copy)
192+
190193
elif not (is_integer_dtype(values) or is_float_dtype(values)):
191194
raise TypeError("{} cannot be converted to an IntegerDtype".format(
192195
values.dtype))

0 commit comments

Comments
 (0)