title: Pandas generating colun
body: <p>I have the following df:</p>
  <pre><code>from    to  
  
  5   7   
  
  8   10  
  </code></pre>
  <p>I am trying to get the following output:</p>
  <pre><code>from    to  zip_1   zip_2   zip_3   zip_4
  
  5   8   5   6   7   8
  
  9   10  9   10      
  </code></pre>
  <p>I tried the following code but resulted in an error.</p>
  <pre><code>for index, row in df.iterrows():
      zip_index = 0
      colName = 'zip' + '_' + str(zip_index)
      while row[colName] != row.To: 
          zip_index = zip_index + 1
          NewCol = 'zip' + '_' + str(zip_index)
          row[NewCol] = row[colName] + 1
          colName = NewCol
  </code></pre>
  <p>What am I missing?</p>
  <p>Thanks!</p>