title: Fastest way with parallelization to compute distances between two points with Python code
body: <p>I have a data frame 'data' with millions of rows. Each row has coordinates ('x','y'), I would like to compute distances among consecutive pairs of the coordinates in the most efficient way python can provide. Will parallelization help here? </p>
  
  <p>I saw approaches here that suggests to use cython. However I would like to see only python solutions.</p>
  
  <p>Here is the snippet of my data </p>
  
  <pre><code>points = 
  [(26406, -6869),
   (27679, -221),
   (27679, -221),
   (26416, -6156),
   (26679, -578),
   (26679, -580),
   (27813, -558),
   (26254, -1097),
   (26679, -580),
   (27813, -558),
   (28258, -893),
   (26253, -1098),
   (26678, -581),
   (27811, -558),
   (28259, -893),
   (26252, -1098),
   (27230, -481),
   (26679, -582),
   (27488, -5849),
   (27811, -558),
   (28259, -893),
   (26250, -1099),
   (27228, -481),
   (26679, -582),
   (27488, -5847),
   (28525, -1465),
   (27811, -558),
   (28259, -892)]
  </code></pre>
  
  <p>I believe that my first approach using for-loop can be definitely improved: </p>
  
  <pre><code>    from scipy.spatial import distance
      def comp_dist(points):
          size  =len(points)
          d = 0
          i=1
          for i in range(1,size):
              if i%1000000==0:
                  print i
              # print "i-1:", points[i-1]
              # print "i: ", points[i]
              dist = distance.euclidean(points[i-1],points[i])
              d= d+dist
          print d
  
      distance = comp_dist(points)
  </code></pre>
  
  <p>Thank you for your answers in advance. </p>