Equivalent of Matlab in Python -
i have code want reference elements of m in matlab:
nnanm = sum(isnan(m(:)));
how tell python reference elements of m?
if understand code correctly, count nan elements in matrix. if so, can equivalent thing in python using numpy following code:
import numpy np np.count_nonzero(np.isnan(m))
if insist on sum
function, work:
np.sum(np.isnan(m))
Comments
Post a Comment