If I compare two array which contain NaNs
like so:
a = np.array([[1,2,3], [np.nan, 2, 3]])
b = np.array([[1,2,3], [np.nan, 2, 3]])
np.where(a==b, a, -1)
I get
array([[ 1., 2., 3.],
[-1., 2., 3.]])
which makes sense because:
np.nan == np.nan
yields False
However, np.where(a is b, a, -1)
does not make sense either.
np.allclose(a, b, 1e-5)
yields False
Since bith arrays have the same values, how can I prove that?