Dear all:
I have this function and it works just fine but it is slow:
Yet this line does not work and always returns ()? Any suggestions? Thanks!!!
I have this function and it works just fine but it is slow:
Code:
def common_index(list1, list2, val1, val2):
assert len(list1) == len(list2), "List not of equal length"
for i in range(len(list1)):
if list1[i] == val1 and list2[i] == val2:
return [i]
To optimize it:
coord_ind=numpy.where(list1==val1 and list2==val2)
Comment