Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy.where() for substring

foo = 'aa'
bar = np.array(['aaa', 'aab', 'aca'])
out = [i for i, v in enumerate(bar) if foo in v]
# out = [0, 1]

bar = ['aca', 'bba', 'baa', 'aaf', 'ccc']
out = [i for i, v in enumerate(bar) if foo in v]
# out = [2, 3]
Comment

PREVIOUS NEXT
Code Example
Python :: how to filter csv file by columns 
Python :: pagerank formula 
Python :: permcheck codility python 
Python :: programe to find contagious sum of sequence 
Python :: email slicer in python code user input 
Python :: how to search over a notebook in python 
Python :: declare array with given size python 
Python :: python which packages depend on package 
Python :: a.all() numpy 
Python :: ladnha; 
Python :: import nifti to numpy 
Python :: how to use google translate api in python 
Python :: how to get the remainder of a number when dividing in python 
Python :: iris data pandas scatterplot 
Python :: improt kmean 
Python :: pasar tupla a funcion python 
Python :: pysftp get-r 
Python :: python merge two byte files 
Python :: python remove middle of string 
Python :: crop image using opencv with height and width 
Python :: python reverse words and swap case 
Python :: pbcopy stands for 
Python :: py if else if 
Python :: plt force axis numbers 
Python :: python ordering items in a list 
Python :: python 3.7.8 download 
Python :: np.all() 
Python :: re.split 
Python :: days calculator python 
Python :: c to python converter 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =