Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
import numpy as np
data={"x":[1,0],"y":[1,0]}
df=pd.DataFrame(data,dtype="Float64")
df['z']=df['y']/df['x']
df['z'].isna()
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.
0 False
1 False
Name: z, dtype: bool
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.
0 False
1 True
Name: z, dtype: boolean
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.
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] 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