title: Iterating through DataFrame with columns named after an array of numbers
body: <p>so I have the following code: </p>
  
  <pre><code>rang=np.linspace((0.8*Sclose), (1.2*Sclose), 100)
  ts=[6, 5, 10, 15]
  df=pd.DataFrame(index=rang, columns=list(ts))
  </code></pre>
  
  <p>which gives: </p>
  
  <pre><code>In[138]: df.head()
  Out[138]: 
             6.0  5.0  10.0 15.0
  209.040000  NaN  NaN  NaN  NaN
  210.095758  NaN  NaN  NaN  NaN
  211.151515  NaN  NaN  NaN  NaN
  212.207273  NaN  NaN  NaN  NaN
  213.263030  NaN  NaN  NaN  NaN
  </code></pre>
  
  <p>which is what I want. What I want to do next is fill in the columns by parsing the column name and the index at that point to a method which will return a value. </p>
  
  <pre><code>def method1(x, y): 
      return (x+y), (x*y)
  
  for x, y in list(ts), range(len(df.index)):
       df[x][y]=method1(x, df.index[y])[0]
  </code></pre>
  
  <p>but that's not working. Also note that the length and values in ts will vary most times I run the code so it needs to be flexible enough to be able to handle that. Hence why I tried the loop that I did. </p>