title: Summarizing a dictionary into another one
body: <p>I have a dictionary of dictionaries in python like this example:</p>
  
  <p>small example:</p>
  
  <pre><code>d = {1: {'A': 11472, 'C': 8405, 'T': 11428, 'G': 6613}, 
       2: {'A': 11678, 'C': 9388, 'T': 10262, 'G': 6590}, 
       3: {'A': 2945, 'C': 25843, 'T': 6980, 'G': 2150}}
  </code></pre>
  
  <p>every sub-dictionary has items in which keys are one of these letters: <code>A, C, T or G</code>. and the values are absolute numbers. for every item I want to get the <code>percentage</code> of every letter based on its value. and at the end I want to make a new dictionary like the input example in which instead of absolute value there would be percentage. the expected output for the small example would be like this:</p>
  
  <pre><code>result = {1: {'A': 30.34, 'C': 22.16, 'T': 30, 'G': 17.5}, 
            2: {'A': 30.78, 'C': 24.76, 'T': 27.06, 'G': 17.4}, 
            3: {'A': 7.78, 'C': 68.15, 'T': 18.4, 'G': 5.67}}
  </code></pre>
  
  <p>I am trying to do that in python using the following code:</p>
  
  <pre><code>values = dict.values()
  freq = {}
  for i in d.keys()
      freq[i] = d.values(i)/d.values
  </code></pre>
  
  <p>but it does not return what i expect. do you know how to fix it?</p>