📜  python np get indices where value - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:37.374000             🧑  作者: Mango

代码示例1
x = numpy.array([1,0,2,0,3,0,4,5,6,7,8])
numpy.where(x == VALUE)[0]
# e.g. for VALUE = 0, it prints:
array([1, 3, 5])