title: Binning a numpy array
body: <p>I have a numpy array which contains time series data.  I want to bin that array into equal partitions of a given length (it is fine to drop the last partition if it is not the same size) and then calculate the mean of each of those bins.</p>
  
  <p>I suspect there is numpy, scipy, or pandas functionality to do this.</p>
  
  <p>example:</p>
  
  <pre><code>data = [4,2,5,6,7,5,4,3,5,7]
  </code></pre>
  
  <p>for a bin size of 2:</p>
  
  <pre><code>bin_data = [(4,2),(5,6),(7,5),(4,3),(5,7)]
  bin_data_mean = [3,5.5,6,3.5,6]
  </code></pre>
  
  <p>for a bin size of 3:</p>
  
  <pre><code>bin_data = [(4,2,5),(6,7,5),(4,3,5)]
  bin_data_mean = [7.67,6,4]
  </code></pre>