title: Find float in ndarray
body: <p>I tried to find a float number in ndarray. Due to the software package I am using (Abaqus), the precision it outputs is a little bit low. For example, 10 is something like 10.00003. Therefore, I was wondering whether there is a "correct" way to do it, that is neater than my code.</p>
  
  <p>Example code:</p>
  
  <pre><code>import numpy as np
  
  array = np.arange(10)
  number = 5.00001
  </code></pre>
  
  <p>if I do this：</p>
  
  <pre><code>idx = np.where(number==array)[0][0]
  </code></pre>
  
  <p>Then the result is empty because 5.00001 does not equal to 5.</p>
  
  <p>Now I am doing:</p>
  
  <pre><code>atol = 1e-3 # Absolute tolerance
  idx = np.where(abs(number-array) &lt; atol)[0][0]
  </code></pre>
  
  <p>which works, and is not too messy... Yet I was wondering there would be a neater way to do it. Thanks!</p>
  
  <p>PS: <code>numpy.allclose()</code> is another way to do it, but I need to use <code>number * np.ones([array.shape[0], array.shape[1]])</code> and it still seems verbose to me...</p>
  
  <hr>
  
  <p>Edit: Thank you all so much for the fantastic answers! np.isclose() is the exact function that I am looking for, and I missed it since it is not in the doc... I wouldn't have realized this until they update the doc, if it weren't you guys. Thank you again!</p>