I am building a simple null identifier function for identifying nan in Numpy arrays (not Pandas DataFrames or Series), but my code does not seem to work, even though after going over it multiple times I still see no problems with the syntax. What you guys think? Thank you The array:
X = np.array([[1,2,4,np.nan],[3,np.nan,4,2],[5,1,6,7],[np.nan,1,2,9]])
The iteration:
for i in range(X.shape[0]):
for j in range(X.shape[1]):
if X[i,j] == np.nan:
print("This entry is null")
else:
print("This one is not")
It returns: "This one is not" sixteen times (the size of the array). In other words, no missing values apparently. What's wrong?