title: python groupby itertools list methods
body: <p>I have a list like this:
      #[YEAR, DAY, VALUE1, VALUE2, VALUE3]</p>
  
  <pre><code>[[2014, 1, 10, 20, 30],
  [2014, 1, 3, 7, 4],
  [2014, 2, 14, 43,5],
  [2014, 2, 33, 1, 6]
  ...
  [2013, 1, 34, 54, 3],
  [2013, 2, 23, 33, 2],
  ...]
  </code></pre>
  
  <p>and I need to group by years and days, to obtain something like:</p>
  
  <pre><code>[[2014, 1, sum[all values1 with day=1), sum(all values2 with day =1), avg(all values3 with day=1)],
  [2014, 2, sum[all values1 with day=2), sum(all values2 with day =2), avg(all values3 with day=2)],
  ....
  [2013, 1, sum[all values1 with day=1), sum(all values2 with day =1), avg(all values3 with day=1)],
  [2013, 2, sum[all values1 with day=2), sum(all values2 with day =2), avg(all values3 with day=2)],,
  ....]
  </code></pre>
  
  <p>How can I do that with itertool?, I can't use pandas or numpy because my system doesn't support it. Thanks a lot for your help.</p>