Skip to content

BUG: np.isnan raises on pyarrow dtypes #62506

@MarcoGorelli

Description

@MarcoGorelli

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

hm that's raising for me In [1]: import pandas as pd In [2]: pd.set_option("mode.nan_is_na", False) In [3]: s = pd.Series([-1, 0, None], dtype='Int64[pyarrow]')**.5 In [4]: s Out[4]: 0 NaN 1 0.0 2 <NA> dtype: double[pyarrow] In [5]: import numpy as np In [6]: np.isnan(s) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[6], line 1 ----> 1 np.isnan(s) File ~/scratch/.venv/lib/python3.12/site-packages/pandas/core/generic.py:2051, in NDFrame.__array_ufunc__(self, ufunc, method, *inputs, **kwargs) 2047 @final 2048 def __array_ufunc__( 2049 self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any 2050 ): -> 2051 return arraylike.array_ufunc(self, ufunc, method, *inputs, **kwargs) File ~/scratch/.venv/lib/python3.12/site-packages/pandas/core/arraylike.py:399, in array_ufunc(self, ufunc, method, *inputs, **kwargs) 396 elif self.ndim == 1: 397 # ufunc(series, ...) 398 inputs = tuple(extract_array(x, extract_numpy=True) for x in inputs) --> 399 result = getattr(ufunc, method)(*inputs, **kwargs) 400 else: 401 # ufunc(dataframe) 402 if method == "__call__" and not kwargs: 403 # for np.<ufunc>(..) calls 404 # kwargs cannot necessarily be handled block-by-block, so only 405 # take this path if there are no kwargs File ~/scratch/.venv/lib/python3.12/site-packages/pandas/core/arrays/base.py:2539, in ExtensionArray.__array_ufunc__(self, ufunc, method, *inputs, **kwargs) 2536 if result is not NotImplemented: 2537 return result -> 2539 return arraylike.default_array_ufunc(self, ufunc, method, *inputs, **kwargs) File ~/scratch/.venv/lib/python3.12/site-packages/pandas/core/arraylike.py:492, in default_array_ufunc(self, ufunc, method, *inputs, **kwargs) 488 raise NotImplementedError 490 new_inputs = [x if x is not self else np.asarray(x) for x in inputs] --> 492 return getattr(ufunc, method)(*new_inputs, **kwargs) TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Issue Description

it raises

Expected Behavior

I'd have expected

[True, False, NA] 

output

Installed Versions

INSTALLED VERSIONS

commit : e97a56e
python : 3.12.5
python-bits : 64
OS : Linux
OS-release : 6.6.87.2-microsoft-standard-WSL2
Version : #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : C.UTF-8

pandas : 3.0.0.dev0+2451.ge97a56e746
numpy : 2.3.3
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : None
sphinx : None
IPython : 9.2.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.4
bottleneck : None
fastparquet : None
fsspec : 2025.9.0
html5lib : None
hypothesis : None
gcsfs : 2025.2.0
jinja2 : 3.1.6
lxml.etree : None
matplotlib : 3.10.3
numba : None
numexpr : None
odfpy : None
openpyxl : None
psycopg2 : None
pymysql : None
pyarrow : 21.0.0
pyiceberg : None
pyreadstat : None
pytest : None
python-calamine : None
pytz : 2025.2
pyxlsb : None
s3fs : None
scipy : 1.16.0
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

Labels

Arrowpyarrow functionalityBugPDEP missing valuesIssues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions