Difference between np.nan and np.NaN Difference between np.nan and np.NaN arrays arrays

Difference between np.nan and np.NaN


so basicallyNaN,NAN and nan are equivalent definitions of nan

or in other words

NaN and NAN are aliases of nan

np.nannp.NaNnp.NAN

if you will check the equality of these it returns False

and if you check the types of all these 3 then you will find that all are of same type(float)

but let

a=np.NaNb=np.NANc=np.nan

now if you will check the equality of a,b and c it returns True

Even in the documentation(line 4) it is said that:-

cannot use equality to test NaNs

you can check the documentation from here:-

https://numpy.org/doc/stable/user/misc.html?highlight=numpy%20nan


actually even if you test:np.nan == np.nanyou would getfalse