title: How to get access to a column in a 2D list in Python?
body: <p>I am using a 2D list, and I'd like to calculate its mean value by row. The following is my code:</p>
  
  <pre><code>import numpy as np
  
  mylist = np.zeros((2,120))    # This gives you a 2 by 120 2D list with 2 rows, and 120 columns
  average_list = np.zeros(120)
  
  for col in xrange(120):
      average_list[col] = np.mean(mylist[:][col])
  </code></pre>
  
  <p>However, the above chunk generates this:</p>
  
  <blockquote>
    <p>IndexError: index 2 is out of bounds for axis 0 with size 2</p>
  </blockquote>
  
  <p>As I find during debugging, the problem happens at the <code>col</code> in <code>np.mean(mylist[:][col])</code></p>
  
  <p>May I know what am I wrong about this? </p>
  
  <p>Thanks.</p>