Fast check for NaN in NumPy
use .any()
if numpy.isnan(myarray).any()

numpy.isfinite maybe better than isnan for checking
if not np.isfinite(prop).all()
I'm looking for the fastest way to check for the occurrence of NaN (np.nan) in a NumPy array X. np.isnan(X) is out of the question, since it builds a boolean array of shape X.shape, which is potentially gigantic.
I tried np.nan in X, but that seems not to work because np.nan != np.nan. Is there a fast and memory-efficient way to do this at all?
(To those who would ask "how gigantic": I can't tell. This is input validation for library code.)