Skip to content

Commit df626f5

Browse files
committed
Cast to numpy
1 parent f9cd44e commit df626f5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pandas/core/dtypes/missing.py

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

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):
232+
if is_string_dtype(dtype):
235233
result = _isna_string_dtype(values, dtype, old=old)
236234
elif needs_i8_conversion(dtype):
237235
# this is the NaT pattern

0 commit comments

Comments
 (0)