Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

find index of values greater than python

>>> [i for i,v in enumerate(a) if v > 4]
[4, 5, 6, 7, 8]
#enumerate returns the index and value of each item in an array. 
#So if the value v is greater than 4, include the index i in the new array.
Comment

PREVIOUS NEXT
Code Example
Python :: python convert a list to dict 
Python :: wait driver selenium 
Python :: 3d array python numpy 
Python :: convert ndarray to csr_matrix 
Python :: requests.Session() proxies 
Python :: difference between supervised and unsupervised learning 
Python :: run exe from python 
Python :: python get attributes of object 
Python :: add time and date to datetime 
Python :: convert matplotlib figure to cv2 image 
Python :: convert list to numpy array 
Python :: How to construct a prefix sum array in python? 
Python :: python list remove at index 
Python :: print out a name in python 
Python :: python custom sort 
Python :: windows 10 reset django migrations 
Python :: turn a list into a string python 
Python :: pandas calculate same day 3 months ago dateoffset 
Python :: check python version windows 
Python :: pandas change dtype 
Python :: python substring in string 
Python :: extract one column from dataframe python 
Python :: python compare timestamps 
Python :: see attributes of object python 
Python :: string to array python 
Python :: slug url 
Python :: Return the number of times that the string "hi" appears anywhere in the given string. python 
Python :: numpy int64 to int 
Python :: process rows of dataframe in parallel 
Python :: python check if list contains 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =