title: Fast fuse of close points in a numpy-2d (vectorized)
body: <p>I have a question similar to the question asked here:
  <a href="https://stackoverflow.com/questions/19375675/simple-way-of-fusing-a-few-close-points">simple way of fusing a few close points</a>. I want to replace points that are located close to each other with the average of their coordinates. The closeness in cells is specified by the user (I am talking about euclidean distance). </p>
  
  <p>In my case I have a lot of points (about 1-million). This method is working, but is time consuming as it uses a double for loop.</p>
  
  <p>Is there a faster way to detect and fuse close points in a numpy 2d array?</p>
  
  <hr>
  
  <p>To be complete I added an example:</p>
  
  <pre><code>points=array([[  382.49056159,   640.1731949 ],
     [  496.44669161,   655.8583119 ],
     [ 1255.64762859,   672.99699399],
     [ 1070.16520917,   688.33538171],
     [  318.89390168,   718.05989421],
     [  259.7106383 ,   822.2       ],
     [  141.52574427,    28.68594436],
     [ 1061.13573287,    28.7094536 ],
     [  820.57417943,    84.27702407],
     [  806.71416007,   108.50307828]])
  </code></pre>
  
  <p>A scatterplot of the points is visible below. The red circle indicates the points located close to each other (in this case a distance of 27.91 between the last two points in the array). So if the user would specify a minimum distance of 30 these points should be fused.</p>
  
  <p><a href="https://i.stack.imgur.com/fSvYu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fSvYu.png" alt="enter image description here"></a></p>
  
  <p>In the output of the fuse function the last to points are fused. This will look like:</p>
  
  <pre><code>#output
  array([[  382.49056159,   640.1731949 ],
     [  496.44669161,   655.8583119 ],
     [ 1255.64762859,   672.99699399],
     [ 1070.16520917,   688.33538171],
     [  318.89390168,   718.05989421],
     [  259.7106383 ,   822.2       ],
     [  141.52574427,    28.68594436],
     [ 1061.13573287,    28.7094536 ],
     [  813.64416975,    96.390051175]])
  </code></pre>