What happens when I compare an integer or float with np.nan
in python?
5 < np.nan?
np.nan > 100?
I ran those commands myself and got False
every time. Is this a consistent behavior?
What happens when I compare an integer or float with np.nan
in python?
5 < np.nan?
np.nan > 100?
I ran those commands myself and got False
every time. Is this a consistent behavior?
Yes this is correct. As a matter of fact, the way that np.nan is written, you'll also get False if you try np.nan == np.nan
or np.nan = None
. As stated in the comments, you should use np.isnan instead.