多条件选择:根据多个布尔数组选择数据, 根据不同条件将数据选择不同的类别一、np.where1、返回满足条件的元素的索引import numpy as nparr=np.array([0, 1, 2, ...3, 4, 5, 6])#找到数组中所有大于3的元素的索引indices=np.where(arr>3)print(indices)#输出结果: (array([4, 5, 6]),)2、基于一个条件在两个数组之间选择元素...import numpy as npx=np.array([1, 2, 3, 4, 5])y=np.array([10, 20, 30, 40, 50])#根据条件选择元素,如果条件为真则选择x的元素,...#否则选择y的元素result=np.where(x的条件,在choicelist选择对应的返回结果1、数组import numpy as npx=np.arange(6)condlist=[x3]choicelist