I'm reading a dat file and loading the values into a numpy array. This 2D array has some nan values in the second column:
myarray = array([[ 0. , nan],
[ 0.00057525, 4],
[ 0.53212512, 5],
[ 0.53268938, nan]])
I need to get rid off the rows with nan values. This is what I'm trying
import numpy as np
myarray = np.loadtxt(filename, skiprows=30, usecols=(0,1))
intensity = myarray[:,1]
for row in intensity:
if np.isnan(intensity):
np.delete(myarray, (0), axis=0)
print myarray
But I'm getting this error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Any advices in how to proceed?
Thanks in advance