Skip to content

Commit a74e473

Browse files
committed
Add test for IntegerArray conversion
1 parent 63d4bdd commit a74e473

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/dtypes/test_inference.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,14 @@ def test_maybe_convert_objects_datetime(self):
552552
out = lib.maybe_convert_objects(arr, convert_datetime=1, convert_timedelta=1)
553553
tm.assert_numpy_array_equal(out, exp)
554554

555+
def test_maybe_convert_objects_nullable_integer(self):
556+
# GH27335
557+
arr = np.array([2, np.NaN], dtype=object)
558+
result = lib.maybe_convert_objects(arr, convert_to_nullable_integer=1)
559+
from pandas.core.arrays import IntegerArray
560+
exp = IntegerArray(np.array([2, 0], dtype='i8'), np.array([False, True]))
561+
tm.assert_equal(result, exp)
562+
555563
def test_mixed_dtypes_remain_object_array(self):
556564
# GH14956
557565
array = np.array([datetime(2015, 1, 1, tzinfo=pytz.utc), 1], dtype=object)

0 commit comments

Comments
 (0)