These are the tries I have made:
series1 = np.array([1, 3, None, None, 5]).astype(np.float)
print(series1)
for i in range(series1.shape[0]):
if series1[i] == None:
print(series1[i])
if series1[i] == 'None':
print(i)
try:
if series1[i] == nan:
print(series1[i])
except NameError:
pass
if series1[i] == 'nan':
print(series1[i])
gives output
[ 1. 3. nan nan 5.]
I need the if statements to identify where the elements in the Numpy array is None. But I can't think of anything other than what's in the above code. It works when I don't provide the .astype(np.float) command, it prints out None, but I need the elements to be float