title: Is there any pythonic way to find average of specific tuple elements in array?
body: <p>I want to write this code as pythonic. My real array much bigger than this example.</p>
  
  <p>( 5+10+20+3+2 ) / 5</p>
  
  <blockquote>
    <p>print(np.mean(array,key=lambda x:x[1]))
    TypeError: mean() got an unexpected keyword argument 'key'</p>
  </blockquote>
  
  <pre><code>array = [('a', 5) , ('b', 10), ('c', 20), ('d', 3), ('e', 2)]
  
  sum = 0
  for i in range(len(array)):
      sum = sum + array[i][1]
  
  average = sum / len(array)
  print(average)
  
  import numpy as np
  print(np.mean(array,key=lambda x:x[1]))
  </code></pre>
  
  <p>How can avoid this?
  I want to use second example.</p>
  
  <p>I'm using Python 3.7</p>