您可以
np.where用来获取索引并
np.logical_and设置两个条件:
import numpy as npa = np.array([1, 3, 5, 6, 9, 10, 14, 15, 56])np.where(np.logical_and(a>=6, a<=10))# returns (array([3, 4, 5]),)

您可以
np.where用来获取索引并
np.logical_and设置两个条件:
import numpy as npa = np.array([1, 3, 5, 6, 9, 10, 14, 15, 56])np.where(np.logical_and(a>=6, a<=10))# returns (array([3, 4, 5]),)