title: Append values dynamically by iterating over source pandas dataframe
body: <p>I have a dataframe with the following columns in it.</p>
  <pre><code>df_levels = [&quot;No&quot;,&quot;window1_level&quot;,&quot;window2_level&quot;,&quot;window3_level&quot;,&quot;window4_level&quot;, &quot;window5_level&quot;]
  </code></pre>
  <p>Source dataframe:</p>
  <pre><code>df_source = pd.DataFrame([[111111,123,103,&quot;window1&quot;,&quot;window2&quot;], [333333,104,123,&quot;window3&quot;,&quot;window4&quot;], [678698,111,144,&quot;window1&quot;,&quot;window5&quot;]], columns=['No','level1','level2','value1','value2'])
  
  
  No       level1        level2       value1      value2
  111111      123          103        window1     window2
  333333      104          123        window3     window4
  678698      111          144        window1     window5
  </code></pre>
  <p>Result dataframe:</p>
  <p>df_result:</p>
  <pre><code> No   window1_level window2_level window3_level window4_level window5_level 
   111111      123       103                 
   333333                               104          123
   678698      111                                              144
  </code></pre>
  <p>I am looping through the source dataframe and assign values to the result dataframe (df_result). After assignment, I am not sure on how to append these values to df_result as the row['value1'] and row['value2'] will change depend on the values in df_source.</p>
  <pre><code>for index, row in df_source.iterrows():
   df_result[&quot;No&quot;] = row['No']
   df_t2[str(row['value1'])+&quot;_level&quot;] = row['level1']
   df_t2[str(row['value2'])+&quot;_level&quot;] = row['level2']
  </code></pre>
  <p>Any suggestions would be appreciated!</p>