xxx222 xxx222 - 4 years ago 196
Python Question

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

Say now I have a numpy array which is defined as,


Now I want to have a list that contains all the indices of the missing values, which is
at this case.

Is there any way I can do that?

Answer Source

np.isnan combined with np.argwhere

x = np.array([[1,2,3,4],


array([[1, 2],
       [2, 0]])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download