python - How to get the indices list of all NaN value in numpy array? -


say have numpy array defined as,

[[1,2,3,4], [2,3,nan,5], [nan,5,2,3]] 

now want have list contains indices of missing values, [(1,2),(2,0)] @ case.

is there way can that?

np.isnan combined np.argwhere

x = np.array([[1,2,3,4],               [2,3,np.nan,5],               [np.nan,5,2,3]]) np.argwhere(np.isnan(x)) 

output:

array([[1, 2],        [2, 0]]) 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -