Search for a smaller array within a larger one

Asked

Viewed 29 times

0

I have two frequency lists, one observed and one modeled. I happen to want to find all the values closer to those observed within the model. The first has length of 38 and the second of 303. I did the following

def find_nearest(array,value):
    return np.abs(array-value)).argmin()
indices = []
for k in range(0,len(observadas)):
    np.append(indices, find_nearest(modeladas,observadas[k])
print(indices)

I have individually tested some of the observations within the models, and there are... But what I did returns [ ] Suggestions?

  • What language?

  • Excuse me, python3

  • There’s no missing tag numpy ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.