title: Python: Mean of several dictionaries with the same keys
body: <p>I am trying to find the mean of several dictionaries ( The number of dictionaries will be dependent on user choice) with same keys. Each key is a n dimensional numpy array. </p>
  
  <p>I got my solution using this method</p>
  
  <p><a href="http://nbviewer.ipython.org/bd3d4ff11eb5f6b3ff4e" rel="nofollow">ipython notebook viewer</a></p>
  
  <p>The function I used is </p>
  
  <pre><code>def metaa(lis,name):
      x = len(lis)
      pr=""
      for i in xrange(x):
          if i == 0:
              pr = pr+name+"["+str(i)+"][x]"
          else:
              pr = pr+"+"+name+"["+str(i)+"][x]"
      pr = "("+pr+")/"+str(x)                 
      return pr
  </code></pre>
  
  <p>I created dictionaries like this.</p>
  
  <pre><code>import numpy as np
  a1 = np.random.randint(100,size=(3,10))
  a2 = np.random.randint(100,size=(3,10))
  a3 = np.random.randint(100,size=(3,10))
  al=[a1,a2,a3]
  dicta = {'a1':a1,'a2':a2,'a3':a3}
  dictb = {'a1':a1,'a2':a2,'a3':a3}
  R = [dicta,dictb]
  </code></pre>
  
  <p>I used the same values in both dictionaries for testing.
  I called the function like this.</p>
  
  <pre><code>Res = {}
  for x in R[0]:
      Res[x] = eval(metaa(R,'R'))
  </code></pre>
  
  <p>I think this method is hackish, Is there a better way of solving this?.  </p>