title: Calculate the average of column y for each sublist of a list
body: <p>I am looking for a way to calculate the last x values passed by <code>count_num</code> in the array. How can I do that successfully? </p>
  
  <pre><code>import gdax
  
  public_client = gdax.PublicClient()
  data = public_client.get_product_historic_rates('BTC-USD', 
                      start=None, end=None, granularity=None)
  count_num = 5
  for i in data:    
      index = [i][0][5]
      average = index[-count_num:]/count_num
  </code></pre>
  
  <p>Here is what it returns once I print out the list</p>
  
  <pre><code>[1521965100, 8464.99, 8470, 8464.99, 8470, 1.8307073700000003]
  [1521965040, 8462.29, 8465, 8462.29, 8465, 0.54772126]
  [1521964980, 8462.28, 8462.29, 8462.28, 8462.29, 0.41895371]
  [1521964920, 8462.28, 8475, 8475, 8462.29, 0.9895914299999999]
  [1521964860, 8475, 8475.01, 8475.01, 8475, 0.07485000000000001]
  [1521964800, 8471.91, 8480.93, 8471.91, 8475.01, 0.36869809000000003]
  [1521964740, 8471.9, 8471.91, 8471.91, 8471.91, 0.18909909]
  [1521964680, 8471.31, 8471.91, 8471.31, 8471.91, 0.0864]
  [1521964620, 8471.31, 8480.46, 8480.46, 8471.31, 1.03771926]
  [1521964560, 8481.64, 8490, 8489.99, 8481.64, 10.089637590000004]
  </code></pre>
  
  <p>Here is a sample output for index which I am trying to find the average for.</p>
  
  <pre><code>6.64786609
  1.6042117200000003
  1.58478991
  7.936872120000001
  2.6782738599999987
  1.8307073700000003
  0.54772126
  0.41895371
  0.9895914299999999
  0.07485000000000001
  0.36869809000000003
  0.18909909
  </code></pre>