I am trying to find all None elements in an array using np.where. This is my code:
a = np.array([None, 1, 2, None, 3])
print(np.where(a is None)[0])
print(np.where(a == None)[0])
Oddly, using "a is None" returns an empty array, while using "a==None" returns the correct result. I wonder why this is happening? Thanks!
Update: If a is a python list, then both will behave the same and return []. The difference will only happen when a is cast to an ndarray.