File tree 3 files changed +12
-2
lines changed
3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1365,6 +1365,7 @@ Reshaping
1365
1365
- Bug in :func:`cut` and :func:`qcut` where timezone information was dropped (:issue:`19872`)
1366
1366
- Bug in :class:`Series` constructor with a ``dtype=str``, previously raised in some cases (:issue:`19853`)
1367
1367
- Bug in :func:`get_dummies`, and :func:`select_dtypes`, where duplicate column names caused incorrect behavior (:issue:`20848`)
1368
+ - Bug in :func:`isna`, which cannot handle ambiguous typed lists (:issue:`20675`)
1368
1369
1369
1370
Other
1370
1371
^^^^^
Original file line number Diff line number Diff line change @@ -120,7 +120,9 @@ def _isna_new(obj):
120
120
return _isna_ndarraylike (obj )
121
121
elif isinstance (obj , ABCGeneric ):
122
122
return obj ._constructor (obj ._data .isna (func = isna ))
123
- elif isinstance (obj , list ) or hasattr (obj , '__array__' ):
123
+ elif isinstance (obj , list ):
124
+ return _isna_ndarraylike (np .asarray (obj , dtype = object ))
125
+ elif hasattr (obj , '__array__' ):
124
126
return _isna_ndarraylike (np .asarray (obj ))
125
127
else :
126
128
return obj is None
@@ -146,7 +148,9 @@ def _isna_old(obj):
146
148
return _isna_ndarraylike_old (obj )
147
149
elif isinstance (obj , ABCGeneric ):
148
150
return obj ._constructor (obj ._data .isna (func = _isna_old ))
149
- elif isinstance (obj , list ) or hasattr (obj , '__array__' ):
151
+ elif isinstance (obj , list ):
152
+ return _isna_ndarraylike_old (np .asarray (obj , dtype = object ))
153
+ elif hasattr (obj , '__array__' ):
150
154
return _isna_ndarraylike_old (np .asarray (obj ))
151
155
else :
152
156
return obj is None
Original file line number Diff line number Diff line change @@ -118,6 +118,11 @@ def test_isna_lists(self):
118
118
exp = np .array ([False , False ])
119
119
tm .assert_numpy_array_equal (result , exp )
120
120
121
+ # GH20675
122
+ result = isna ([np .NaN , 'world' ])
123
+ exp = np .array ([True , False ])
124
+ tm .assert_numpy_array_equal (result , exp )
125
+
121
126
def test_isna_nat (self ):
122
127
result = isna ([NaT ])
123
128
exp = np .array ([True ])
You can’t perform that action at this time.
0 commit comments