title: Referring to a specific column and row when using np.polyfit in python
body: <p><strong>Scenario:</strong> I am trying to use the np.polyfit function in Python, to plot my MV-efficient frontier (portfolio optimization). I already have a np array with returns and standard deviations for all my portfolios.</p>
  
  <p><strong>Issue:</strong> I am using the following lines to try to achieve the result:</p>
  
  <pre><code>for i in xrange(num_portfolios):    
      m1 = np.polyfit(results.T[column=1,row=i]), results.Tframe[column=2,row=i], 2)
      x1 = np.sqrt(m1[2] / m1[0])
      gather[0,i] = m1
      gather[1,i] = x1
  </code></pre>
  
  <p>in the line with polyfit, I am trying to refer to the first column of my array (then loop through all the rows), and also refer to the second column of the same array (and also loop through rows). I also use the following lines to store the values for each portfolio.</p>
  
  <p><strong>Obs:</strong> I got this code from <a href="https://blog.quantopian.com/markowitz-portfolio-optimization-2/" rel="nofollow noreferrer">https://blog.quantopian.com/markowitz-portfolio-optimization-2/</a> and am trying to understand how it works in plotting the frontier.</p>
  
  <p><strong>Problem:</strong> my line with m1 has an invalid syntax error that I cannot identify. Probably it the way I am referring to the columns. What is the proper way to do this reference?</p>