diff --git a/pandas/core/arrays/integer.py b/pandas/core/arrays/integer.py index 17e92c3976e2ce..9e045a77856600 100644 --- a/pandas/core/arrays/integer.py +++ b/pandas/core/arrays/integer.py @@ -173,7 +173,7 @@ def coerce_to_array(values, dtype, mask=None, copy=False): values = np.array(values, copy=copy) if is_object_dtype(values): inferred_type = lib.infer_dtype(values) - if inferred_type is 'mixed' and isna(values).any(): + if inferred_type is 'mixed' and isna(values).all(): values = np.empty(len(values)) values.fill(np.nan) elif inferred_type not in ['floating', 'integer', diff --git a/pandas/tests/arrays/test_integer.py b/pandas/tests/arrays/test_integer.py index e6dae0ffaec286..10961173d4b6b5 100644 --- a/pandas/tests/arrays/test_integer.py +++ b/pandas/tests/arrays/test_integer.py @@ -560,7 +560,8 @@ def test_integer_array_constructor_copy(): 1.0, pd.date_range('20130101', periods=2), np.array(['foo']), - [[1, 2], [3, 4]]]) + [[1, 2], [3, 4]], + [np.nan, {'a': 1}]]) def test_to_integer_array_error(values): # error in converting existing arrays to IntegerArrays with pytest.raises(TypeError):