Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python np get indices where value

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])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #np #indices
ADD COMMENT
Topic
Name
2+4 =