Skip to content

Commit 6d4afbc

Browse files
committed
Revert "Cast to numpy"
This reverts commit df626f5.
1 parent 2b4d109 commit 6d4afbc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pandas/core/dtypes/missing.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,15 @@ def _isna_ndarraylike(obj, old: bool = False):
223223
array-like
224224
Array of boolean values denoting the NA status of each element.
225225
"""
226-
if not isinstance(obj, np.ndarray):
227-
values = obj.to_numpy()
228-
else:
229-
values = obj
226+
values = getattr(obj, "_values", obj)
230227
dtype = values.dtype
231228

232-
if is_string_dtype(dtype):
229+
if is_extension_array_dtype(dtype):
230+
if old:
231+
result = values.isna() | (values == -np.inf) | (values == np.inf)
232+
else:
233+
result = values.isna()
234+
elif is_string_dtype(dtype):
233235
result = _isna_string_dtype(values, dtype, old=old)
234236
elif needs_i8_conversion(dtype):
235237
# this is the NaT pattern

0 commit comments

Comments
 (0)