np.argwhere(np.isnan(x))判断数组/矩阵中Nan(或者inf)值的位置:

x = np.array([[2,3,nan],
              [3,nan,1]])
print (np.argwhere(np.isnan(x)))
# array([[0,2],[1,1]])

猜你喜欢

转载自blog.csdn.net/Hero_Never_GIVE_UP/article/details/82026074
np