Python中numpy的np.where()函數

numpy.where() 有兩種用法:python 1. np.where(condition, x, y) 知足條件(condition),輸出x,不知足輸出y。web import numpy as np a = np.arange(10) print(a) aa = np.where(a, 1, -1) print(aa) aaa = np.where(a > 5, 1, -1) prin
相關文章
相關標籤/搜索