Skip to content

Commit

Permalink
BUG-23224 Fix PR 23237 / Integer NA creation from None (#23310)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinZhengBC authored and jreback committed Oct 25, 2018
1 parent c584ae7 commit a20b097
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pandas/core/arrays/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/arrays/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit a20b097

Please sign in to comment.