Skip to content

BUG: Series.isnull() and DataFrame.isnull() do not respect use_inf_as_na option #50495

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

Closed
2 of 3 tasks
jborman-exos opened this issue Dec 29, 2022 · 2 comments
Closed
2 of 3 tasks
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Needs Triage Issue that has not been reviewed by a pandas team member
Milestone

Comments

@jborman-exos
Copy link

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

srs = pd.Series([1, 0, pd.NA, float('Inf')], dtype=pd.Float64Dtype())

# Base case: pd.isnull() and pd.Series.isnull() produce identical results
pd.set_option('use_inf_as_na', False)
assert (srs.isnull() == srs.apply(pd.isnull)).all()

# Raises error below
pd.set_option('use_inf_as_na', True)
assert (srs.isnull() == srs.apply(pd.isnull)).all()  # fails, inconsistent with assertion above

Issue Description

Series.isnull() and DataFrame.isnull() do not respect the option use_inf_as_na=True.

Expected Behavior

While Series.isnull()/DataFrame.isnull() and pd.isnull() are different functions with slightly different applications, I would expect the behavior of each assertion in this example above to be the same.

Installed Versions

INSTALLED VERSIONS

commit : 8dab54d
python : 3.10.8.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.102.1-microsoft-standard-WSL2
Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8

pandas : 1.5.2
numpy : 1.23.5
pytz : 2022.7
dateutil : 2.8.2
setuptools : 63.2.0
pip : 22.3.1
Cython : None
pytest : 7.2.0
hypothesis : None
sphinx : 5.3.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.5
jinja2 : 3.1.2
IPython : 8.7.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli : None
fastparquet : None
fsspec : 2022.11.0
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 10.0.1
pyreadstat : None
pyxlsb : None
s3fs : 2022.11.0
scipy : None
snappy : None
sqlalchemy : 1.4.45
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None

@jborman-exos jborman-exos added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 29, 2022
@SaadAhmedGit
Copy link

take

@SaadAhmedGit SaadAhmedGit removed their assignment Jan 30, 2023
@jbrockmendel jbrockmendel added this to the 3.0 milestone Nov 1, 2023
@simonjayhawkins simonjayhawkins added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Feb 6, 2024
@mroeschke
Copy link
Member

Given that this option was deprecated in 2.1 #53494, going to close as a wont fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants