title: Find nearest neighbors of a numpy array in list of numpy arrays using euclidian distance
body: <p>I have a n-dimensional vector and I want to find its k nearest neighbors in a list of n-dimensional vectors using euclidian distance.</p>
  
  <p>I wrote the following code (with k=10) which works but runs too slowly and I was wondering if there was a more optimal solution. </p>
  
  <pre><code>def nearest_neighbors(value, array, nbr_neighbors=1):
      return np.argsort(np.array([np.linalg.norm(value-x) for x in array]))[:nbr_neighbors]
  </code></pre>