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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -