numpy:找到指定元素的索引示例

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

函数: np.argwhere

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

以上这篇numpy:找到指定元素的索引示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。