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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -