np.count_nonzero(~np.isnan(data))
import math print math.isnan(float('NaN'))OutputTrue print math.isnan(1.0)OutputFalse