Skip to content

Commit a20b097

Browse files
JustinZhengBCjreback
authored andcommitted
BUG-23224 Fix PR 23237 / Integer NA creation from None (#23310)
1 parent c584ae7 commit a20b097

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/core/arrays/integer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def coerce_to_array(values, dtype, mask=None, copy=False):
173173
values = np.array(values, copy=copy)
174174
if is_object_dtype(values):
175175
inferred_type = lib.infer_dtype(values)
176-
if inferred_type is 'mixed' and isna(values).any():
176+
if inferred_type is 'mixed' and isna(values).all():
177177
values = np.empty(len(values))
178178
values.fill(np.nan)
179179
elif inferred_type not in ['floating', 'integer',

pandas/tests/arrays/test_integer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ def test_integer_array_constructor_copy():
560560
1.0,
561561
pd.date_range('20130101', periods=2),
562562
np.array(['foo']),
563-
[[1, 2], [3, 4]]])
563+
[[1, 2], [3, 4]],
564+
[np.nan, {'a': 1}]])
564565
def test_to_integer_array_error(values):
565566
# error in converting existing arrays to IntegerArrays
566567
with pytest.raises(TypeError):

0 commit comments

Comments
 (0)