title: Python - normalize/standardize dictionary values
body: <p>I have three dictionaries where keys are the same, however the scales of these dictionaries vary significantly. I want to normalize/standardize the values of these dictionaries, so I can then sum them together to create an overall combined score for each key (with equal weights for the three different inputs). </p>
  
  <pre><code>Current:
  page_score = {'andrew.lewis: 6.599', 'jack.redmond: 4.28'.....'geoff.storey: 2.345)
  eigen_score = {'andrew.lewis: 4.97', 'jack.redmond: 2.28'.....'geoff.storey: 3.927)
  (1 more)
  
  
  Normalized:
  page_score = {'andrew.lewis: 0.672', 'jack.redmond: 0.437'.....'geoff.storey: 0.276)
  hub_score = {'andrew.lewis: 0.432', 'jack.redmond: 0.762'.....'geoff.storey: 0.117)
  (1 more)
  
  End Output:
  overall_score = {'andrew.lewis: 2.738.....) """combination of values across the three standardized dictionaries"""
  </code></pre>
  
  <p>How can I achieve this? I know how to do this for a list, however I'm not sure how to achieve this for a dictionary. I've tried the solutions provided <a href="https://stackoverflow.com/questions/16417916/normalizing-dictionary-values">here</a> and <a href="https://stackoverflow.com/questions/46711557/calculating-min-and-max-over-a-list-of-dictionaries-for-normalizing-dictionary-v">here</a> already, however strangely they created various errors. Any help would be appreciated. Code so far:</p>
  
  <pre><code>G = nx.read_weighted_edgelist('Only_50_Employees1.csv', delimiter=',', create_using = nx.DiGraph(), nodetype=str)
  
  between_score = dict(nx.betweenness_centrality(G))
  eigen_score = dict(nx.eigenvector_centrality(G))
  page_score = nx.pagerank(G)
  </code></pre>
  
  <p>Tried Already</p>
  
  <pre><code>factor=1.0/sum(page_score.values())
  normalised_d = {k: v*factor for k, v in page_score.items()}
  
  def normalize(page_score, target=1.0):
  raw = sum(page_score.values())
  factor = target/raw
  return {key:value*factor for key,value in page_score.items()}
  
  def really_safe_normalise_in_place(page_score):
  factor=1.0/math.fsum(page_score.values())
  for k in page_score:
      page_score[k] = page_score[k]*factor
  key_for_max = max(page_score.tems(), key=operator.itemgetter(1))[0]
  diff = 1.0 - math.fsum(page_score.values())
  #print "discrepancy = " + str(diff)
  page_score[key_for_max] += diff
  d={v: v+1.0/v for v in xrange(1, 1000001)}
  really_safe_normalise_in_place(d)
  print math.fsum(page_score.values())
  </code></pre>
  
  <p>Screenshot of page_score dictionary:
  <a href="https://i.stack.imgur.com/aimvk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aimvk.jpg" alt="enter image description here"></a></p>