python 中 np.where

python或者numpy中可以返回符合某一条件的下标的函数是np.where(),不过np.where()并不接受list类型的参数,可见np.where()既能够接收三个参数,用于三目运算,也可接收一个参数,返回符合条件的下标。php >>a = np.array(a) >>a array([1, 2, 3, 1, 2, 3, 1, 2, 3]) >>idx = np.where(a > 2)
相关文章
相关标签/搜索