One - One Code All

Blog Content

numpy中的ndarray数组返回符合特定条件的元素索引方法np.where

Python   2012-01-21 21:29:52

numpy中的ndarray数组返回符合特定条件的元素索引方法np.where

import numpy as np
arr=np.array([1,1,1,134,45,3,46,1,2])
print(np.where(arr==1))
print(np.argwhere(arr < 5))



上一篇:在numpy中将单个元素添加到数组
下一篇:python找出一个列表中相同元素的多个索引

The minute you think of giving up, think of the reason why you held on so long.