title: How to Group dictionary values in python and subtotal
body: <p>I have the following dictionary</p>
  
  <pre class="lang-py prettyprint-override"><code>#BEFORE
  data={
  'cell_1':['13a'], 'jam_1': ['07-08'], 'model_1': ['SUPERSTAR'], 'output_1': ['10'], 'output_jam_1': [''], 'time_1': [''], 'output_ot_1': [''], 'time_ot_1': [''],
  'cell_2':['13a'], 'jam_2': ['07-08'], 'model_2': ['SUPERSTAR'], 'output_2': ['20'], 'output_jam_2': [''], 'time_2': [''], 'output_ot_2': [''], 'time_ot_2': [''], 
  'cell_3':['13c'], 'jam_3': ['07-08'], 'model_3': ['SUPERSTAR'], 'output_3': ['40'], 'output_jam_3': [''], 'time_3': [''], 'output_ot_3': [''], 'time_ot_3': [''], 
  'cell_4':['13b'], 'jam_4': ['08-09'], 'model_4': ['SUPERSTAR'], 'output_4': ['30'], 'output_jam_4': [''], 'time_4': [''], 'output_ot_4': [''], 'time_ot_4': [''],
  'cell_5':['13d'], 'jam_5': ['16-17'], 'model_5': ['SUPERSTAR'], 'output_5': ['40'], 'output_jam_5': [''], 'time_5': [''], 'output_ot_5': [''], 'time_ot_5': [''],
  'cell_6':['13d'], 'jam_6': ['16-17'], 'model_6': ['SUPERSTAR'], 'output_6': ['40'], 'output_jam_6': [''], 'time_6': [''], 'output_ot_6': [''], 'time_ot_6': [''],
  'cell_7':['13d'], 'jam_7': ['17-18'], 'model_7': ['SUPERSTAR'], 'output_7': ['10'], 'output_jam_7': [''], 'time_7': [''], 'output_ot_7': [''], 'time_ot_7': [''],
  'cell_8':['13d'], 'jam_8': ['18-19'], 'model_8': ['SUPERSTAR'], 'output_8': ['60'], 'output_jam_8': [''], 'time_8': [''], 'output_ot_8': [''], 'time_ot_8': [''],
  }
  I WANT
  #AFTER
  data={
  'cell_1':['13a'], 'jam_1': ['07-08'], 'model_1': ['SUPERSTAR'], 'output_1': ['10'], 'output_jam_1': ['30'], 'time_1': ['0.33'], 'output_ot_1': [''], 'time_ot_1':[''],
  'cell_2':['13a'], 'jam_2': ['07-08'], 'model_2': ['SUPERSTAR'], 'output_2': ['20'], 'output_jam_2': ['30'], 'time_2': ['0.67'], 'output_ot_2': [''], 'time_ot_2':[''],
  'cell_3':['13c'], 'jam_3': ['07-08'], 'model_3': ['SUPERSTAR'], 'output_3': ['40'], 'output_jam_3': ['40'], 'time_3': ['1'], 'output_ot_3': [''], 'time_ot_3':[''],
  'cell_4':['13b'], 'jam_4': ['08-09'], 'model_4': ['SUPERSTAR'], 'output_4': ['30'], 'output_jam_4': ['30'], 'time_4': ['1'], 'output_ot_4': [''], 'time_ot_4':[''],
  'cell_5':['13d'], 'jam_5': ['16-17'], 'model_5': ['SUPERSTAR'], 'output_5': ['40'], 'output_jam_5': [''], 'time_5': [''], 'output_ot_5': ['80'], 'time_ot_5':['0.5'],
  'cell_6':['13d'], 'jam_6': ['16-17'], 'model_6': ['SUPERSTAR'], 'output_6': ['40'], 'output_jam_6': [''], 'time_6': [''], 'output_ot_6': ['80'], 'time_ot_6':['0.5'],
  'cell_7':['13d'], 'jam_7': ['17-18'], 'model_7': ['SUPERSTAR'], 'output_7': ['10'], 'output_jam_7': [''], 'time_7': [''], 'output_ot_7': ['10'], 'time_ot_7':['1'],
  'cell_8':['13d'], 'jam_8': ['18-19'], 'model_8': ['SUPERSTAR'], 'output_8': ['60'], 'output_jam_8': [''], 'time_8': [''], 'output_ot_8': ['60'], 'time_ot_8':['1'],
  }
  </code></pre>
  
  <ol>
  <li><p>How can I obtain the sum of the key 'output' for every dictionary values '07-08' '08-09' and values 13a, 13b, 13c, 13d in the list of dictionaries and then I want to insert that to 'output_jam'.</p></li>
  <li><p>How can I obtain the sum of the key 'output' for every dictionary values '16-17', '17-18', '18-19' in the list of dictionaries and then I want to insert that to 'output_ot'.</p></li>
  <li><p>How can I calculate 'time' using formula (time = output / output jam).</p></li>
  <li><p>How can I obtain the calculate 'time_ot' using formula (time_ot = output /output_ot)</p></li>
  </ol>
  
  <p>Could you please have your suggestions on this??</p>