removing nan values from an array,x = x[~numpy.isnan(x)]