Description
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