Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I don't quiet get the same results from both the methods Commented Dec 26, 2013 at 13:37
  • I have added a Clarification section towards the end of the question to explain this Commented Dec 28, 2013 at 5:16
  • The search sorted algorithm works well for me but it fails if any value of test_array is larger than the max value of known_array. In this case, np.searchsorted will return an index which is 1 too large to be used as an index into known_array_sorted. I have edited the answer above to fix this case. Please check it works for you! Commented Jul 8, 2014 at 14:24