Removing nan values from an array,x = x[numpy.logical_not(numpy.isnan(x))]