Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: The isna function returns False for NaN values in a column of type 'double [pyarrow]'. #60564

Closed
3 tasks done
zhengchl opened this issue Dec 14, 2024 · 1 comment
Closed
3 tasks done
Labels
Arrow pyarrow functionality Bug Duplicate Report Duplicate issue or pull request PDEP missing values Issues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint

Comments

@zhengchl
Copy link

zhengchl commented Dec 14, 2024

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

import pandas as pd

df_arrow = pd.DataFrame([[0, 0]], dtype="double[pyarrow]", columns=['a', 'b'])
df_arrow['c'] = df_arrow.a / df_arrow.b
df_arrow.isna()

Issue Description

The isna function returns False for NaN values in the column c, which is of type double [pyarrow]. The output of reproducible example is:

       a      b      c
0  False  False  False

It is clear that column c is 0/0, which is NaN, so it should be True.

Furthermore, if I assign the variable n to reference to column c and call pd.isna, it returns True.

n = df_arrow.iloc[0,2]
pd.isna(n)

Output of this case is True.

Expected Behavior

If I take use of numpy instead of pyarrow as dtype backend, it's as expected.
Expected behavior is:

import pandas as pd
df_np = pd.DataFrame([[0, 0]], columns=['a', 'b'])
df_np['c'] = df_np.a / df_np.b
df_np.isna()

The output is:

       a      b     c
0  False  False  True

Installed Versions

INSTALLED VERSIONS

commit : 0691c5c
python : 3.12.6
python-bits : 64
OS : Darwin
OS-release : 23.6.0
Version : Darwin Kernel Version 23.6.0: Fri Nov 15 15:12:37 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_ARM64_T6030
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : zh_CN.UTF-8
LOCALE : zh_CN.UTF-8

pandas : 2.2.3
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
pip : 24.0
Cython : None
sphinx : None
IPython : 8.24.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.4
lxml.etree : None
matplotlib : 3.9.0
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.3
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : 17.0.0
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.14.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None

@zhengchl zhengchl added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 14, 2024
@rhshadrach
Copy link
Member

rhshadrach commented Dec 14, 2024

Thanks for the report. Closing as a duplicate of #53887.

@rhshadrach rhshadrach added Duplicate Report Duplicate issue or pull request PDEP missing values Issues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint Arrow pyarrow functionality and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Bug Duplicate Report Duplicate issue or pull request PDEP missing values Issues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint
Projects
None yet
Development

No branches or pull requests

2 participants