title: Numpy Aggregate Rows and Sum
body: <p>I have a Numpy matrix:</p>
  
  <pre><code>M = [[55, 5],
   [56, 3],
   [57, 7],
   [58, 9],
   [59, 3],
   [60, 8],
   [61, 1]] 
  </code></pre>
  
  <p>I want to aggregate by group_size (for example into 3 groups):</p>
  
  <pre><code>group_size = math.ceil(M.size/groups) # math.ceil(7/3) = 3
  </code></pre>
  
  <p>Each aggregated row has a left value being the first left value from the group, and the right value being the sum of all right values from the group. </p>
  
  <p>Expected output:</p>
  
  <pre><code>R = [[55, 15], # 55 first left column value of first group, 15 sum of all right values in group 
   [58, 20], # 58 first left column value of second group, 20 sum of all right values in group
   [61, 1]] # Third group consist only of one row, remainder
  </code></pre>
  
  <p>Is there an efficient way to solve this with Numpy without looping?</p>