title: list of dictionary: aggregate value by grouping by inner dictionary key
body: <p><strong>I have this signature:</strong></p>
  
  <pre><code>def aggregate_by_player_id(input, playerid, fields):
  </code></pre>
  
  <p>By 'fields', i mean fields to sum up grouping by 'playerID' within the 'input'.</p>
  
  <p><strong>I call the function like this:</strong></p>
  
  <pre><code>aggregate_by_player_id(input, 'player', ['stat1','stat3'])
  </code></pre>
  
  <p><strong>Input look like this:</strong></p>
  
  <pre><code>[{'player': '1', 'stat1': '3', 'stat2': '4', 'stat3': '5'},
  {'player': '1', 'stat1': '1', 'stat2': '4', 'stat3': '1'},
  {'player': '2', 'stat1': '1', 'stat2': '2', 'stat3': '3'},
  {'player': '2', 'stat1': '1', 'stat2': '2', 'stat3': '1'},
  {'player': '3', 'stat1': '4', 'stat2': '1', 'stat3': '6'}]
  </code></pre>
  
  <p><strong>My output structure is:</strong></p>
  
  <pre><code>nested_dic = {value_of_playerid1: {'playerid': value_of_playerid1, 'stat1': value_of_stat1, 'stat2': value_of_stat2}, 
                value_of_playerid2: {'playerid': value_of_playerid2, 'stat2': value_of_stat2, 'stat2': value_of_stat2}, 
                value_of_playerid3: {'playerid': value_of_playerid3, 'stat3': value_of_stat3, 'stat3': value_of_stat3}}
  </code></pre>
  
  <p><strong>Hence the output should look like:</strong></p>
  
  <pre><code>{'1': {'player': '1', 'stat1': 4, 'stat3': 6}, 
   '2': {'player': '2', 'stat1': 2, 'stat3': 4}, 
   '3': {'player': '3', 'stat1': 4, 'stat3': 6}} 
  </code></pre>