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)
相關文章
相關標籤/搜索