python - Comparing two lists of strings and getting indices of duplicates -
i want indices of values (strings) duplicated. example:
a=['iii','jjj','rrr'] b=['iii','lll','yyy','ttt','jjj'] s=numpy.where(a==b) i want s return [0,4], @ moment returns [0] same value , in same position in list.
use numpy.where numpy.in1d:
>>> np.where(np.in1d(b, a))[0] array([0, 4]
Comments
Post a Comment