Skip to content

Commit 54431e4

Browse files
committed
possible fix for integer_array with dtype=None
1 parent c18cf28 commit 54431e4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pandas/core/arrays/integer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ 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) and is_integer_dtype(dtype):
190+
elif is_bool_dtype(values) and (is_integer_dtype(dtype) or dtype is None):
191191
values = np.array(values, dtype=int, copy=copy)
192192

193193
elif not (is_integer_dtype(values) or is_float_dtype(values)):

pandas/core/series.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
_is_unorderable_exception, ensure_platform_int, is_bool,
2323
is_categorical_dtype, is_datetime64_dtype, is_datetimelike, is_dict_like,
2424
is_extension_array_dtype, is_extension_type, is_hashable, is_integer,
25-
is_iterator, is_list_like, is_scalar, is_string_like, is_timedelta64_dtype)
25+
is_iterator, is_list_like, is_scalar, is_sparse, is_string_like, is_timedelta64_dtype)
2626
from pandas.core.dtypes.generic import (
2727
ABCDataFrame, ABCDatetimeArray, ABCDatetimeIndex, ABCSeries,
2828
ABCSparseArray, ABCSparseSeries)
@@ -2644,6 +2644,8 @@ def combine(self, other, func, fill_value=None):
26442644

26452645
if is_categorical_dtype(self.values):
26462646
pass
2647+
elif is_bool(new_values[0]) and not is_sparse(self.values):
2648+
pass
26472649
elif is_extension_array_dtype(self.values):
26482650
# The function can return something of any type, so check
26492651
# if the type is compatible with the calling EA.

0 commit comments

Comments
 (0)