numpy:找到指定元素的索引

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29007291/article/details/83186868

目的:在numpy数组中知道指定元素的索引
函数: np.argwhere

>>>x
>>>array([[0, 1, 2],
         [3, 4, 5]])
         
>>>np.argwhere(x>1)
>>>array([[0, 2],
          [1, 0],
          [1, 1],
          [1, 2]])

猜你喜欢

转载自blog.csdn.net/qq_29007291/article/details/83186868