BUG: isna() does not catch np.NaN when datatype is Float64 #60106
Labels
Bug
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
NA - MaskedArrays
Related to pd.NA and nullable extension arrays
Needs Discussion
Requires discussion from core team before further action
PDEP missing values
Issues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint
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
Issue Description
The pandas isna() function does not catch NaN values that are of type np.NaN when using the Float64 datatype. The call
df['z'].isna()
returns a series with following rows.Using the code above, both rows return a false value. Using
df['z'].apply(np.isnan)
correctly returns false for the first row, and true for the second row.Expected Behavior
I would expect the pandas isna() function to also classify the np.NaN type as a null or nan value when using the Float64 datatype.
The returned value of
df['z'].isna()
should be a series with following rows.Installed Versions
INSTALLED VERSIONS
commit : 0691c5c
python : 3.11.9
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22631
machine : AMD64
processor : Intel64 Family 6 Model 141 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Norwegian Bokmål_Norway.1252
pandas : 2.2.3
numpy : 1.26.2
pytz : 2023.3.post1
dateutil : 2.8.2
pip : 24.2
Cython : None
sphinx : None
IPython : 8.18.1
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : 14.0.1
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: