in operator, float(“NaN”) and np.nan
To check if the item is in the list, Python tests for object identity first, and then tests for equality only if the objects are different.1 float(“NaN”) in [float(“NaN”)] is False because two different NaN objects are involved in the comparison. The test for identity therefore returns False, and then the test for equality also … Read more