title: Using Pandas to Iteratively Add Columns to a Dataframe
body: <p>I have some relatively simple code that I'm struggling to put together.  I have a CSV that I've read into a dataframe.  The CSV is panel data (i.e., unique company and year observations for each row).  I have two columns that I want to perform a function on and then I want to create new variables based on the output of the function.</p>
  
  <p>Here's what I have so far with code:</p>
  
  <pre><code>#Loop through rows in a CSV file
  for index, rows in df.iterrows():
      #Start at column 6 and go to the end of the file
      for row in rows[6:]:
          data = perform_function1( row )
          output =  perform_function2(data)    
          df.ix[index, 'new_variable'] = output
          print output
  </code></pre>
  
  <p>I want this code to iterate starting in column 6 and then going to the end of the file (e.g., I have two columns I want to perform the function on Column6 and Column7) and then create new columns based on the functions that were performed (e.g., Output6 and Output7).  The code above returns the output for Column7, but I can't figure out how to create a variable that allows me to capture the outputs from both columns (i.e., a new variable that isn't overwritten by loop).  I searched Stackoverflow and didn't see anything that immediately related to my question (maybe because I'm too big of a noob?).  I would really appreciate your help.</p>
  
  <p>Thanks,</p>
  
  <p>TT</p>
  
  <p>P.S. I'm not sure if I've provided enough detail.  Please let me know if I need to provide more.</p>