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 :: add a tuple to a dictionary python 
Python :: python how to print something at a specific place 
Python :: group by list python 
Python :: download unsplash images python without api 
Python :: print list in one line python 
Python :: all possible combinations in python 
Python :: how to remove an element from dictionary using his value python 
Python :: cite pandas python 
Python :: pytorch check if tensor is on gpu 
Python :: python region 
Python :: check datatype python 
Python :: requests save file python 
Python :: how to install ffmpeg_streaming in python 
Python :: Python create a new png file 
Python :: python mqtt subscribe code 
Python :: python mann kendall test 
Python :: how to remove role discord bot python 
Python :: excel write column 
Python :: df index drop duplicates 
Python :: how to move the last column to the first column in pandas 
Python :: uninstall every package in environment 
Python :: split string python 
Python :: Converting Categorical variables in to integers using Dummy 
Python :: jupyter notebook cell background color 
Python :: convert string to int dataframe column 
Python :: filter directory in python 
Python :: python script that turns bluetooth on 
Python :: get first letter of each word in string python 
Python :: Normalize columns in pandas dataframe2 
Python :: if and else in python 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =