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))