title: How to sum the information at two consecutive positions in a dataframe
body: <p>I have a pandas dataframe with position,k, y. For example</p>
  
  <pre><code>pos k y
  123 0.7 0.5
  124 0.4 0.1
  125 0.3 0.2
  126 0.4 0.1
  128 0.3 0.6
  130 0.4 0.9
  131 0.3 0.2
  </code></pre>
  
  <p>i would like to sum the information at k and y like</p>
  
  <pre><code>123 1.1 0.6
  125 0.7 0.3
  128 0.3 0.6
  130 0.7 1.1
  </code></pre>
  
  <p>so the output has only the first positions and the sum of value the first and its immediate consecutive number which follows it.</p>
  
  <p>I tried grouping by pandas </p>
  
  <pre><code>for k,g in df.groupby(df['pos'] - np.arange(df.shape[0])):
     u=g.ix[0:,2:].sum()
  </code></pre>
  
  <p>but its groups all the consecutive numbers which I dont want </p>
  
  <p>ALSO I NEED SOMETHING FAST AS I HAVE 2611774 ROW IN MY DATAFILE</p>