Search
 
SCRIPT & CODE EXAMPLE
 

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])
Comment

PREVIOUS NEXT
Code Example
::  
::  
::  
Python ::  
::  
Python ::  
Python ::  
::  
::  
::  
::  
:: python list contains 
:: python curl 
Python ::  
::  
::  
Python ::  
:: Disctionary to Array 
::  
::  
Python :: getting multiple of 5 python 
::  
Python ::  
::  
::  
Python ::  
Python ::  
::  
Python ::  
Python ::  
ADD CONTENT
Topic
Content
Source link
Name
5+8 =