title: python pandas dataframe create new column from other columns' cells
body: <p>I have a dataframe like this...</p>
  
  <pre><code>         a_return    b_return  bc_ratio instrument_holding 
  0             NaN         NaN -0.165286                  a 
  1        0.996474    1.013166 -0.164637                  a   
  2        0.997730    0.993540 -0.170058                  a   
  3        1.024294    1.024318 -0.184530                  a   
  4        1.019071    1.047297 -0.148644                  a   
  5        0.992243    1.008210 -0.188752                  a    
  6        1.010331    1.039020 -0.098413                  a   
  7        0.989542    0.991899  0.025051                  b   
  8        1.005197    1.002527 -0.025051                  b 
  9        0.990755    1.002352 -0.099800                  a  
  10       1.006241    0.998375 -0.078643                  b
  </code></pre>
  
  <p>I want to add a column called 'log_ret' where the value from 'a_return' or 'b_return' is used based on the value in the 'instrument_holding' column. Like this...</p>
  
  <pre><code>         a_return    b_return  bc_ratio instrument_holding   log_ret  
  0             NaN         NaN -0.165286                  a       NaN  
  1        0.996474    1.013166 -0.164637                  a  0.996474  
  2        0.997730    0.993540 -0.170058                  a  0.997730  
  3        1.024294    1.024318 -0.184530                  a  1.024294  
  4        1.019071    1.047297 -0.148644                  a  1.019071  
  5        0.992243    1.008210 -0.188752                  a  0.992243  
  6        1.010331    1.039020 -0.098413                  a  1.010331  
  7        0.989542    0.991899  0.025051                  b  0.991899  
  8        1.005197    1.002527 -0.025051                  b  1.002527  
  9        0.990755    1.002352 -0.099800                  a  0.990755  
  10       1.006241    0.998375 -0.078643                  b  0.998375 
  </code></pre>
  
  <p>As you can see, if the row's value for 'instrument_holding' is 'a', 'log_ret' has the value from 'a_return' and if 'instrument_holding' has the value 'b', 'log_ret' has the value from 'b_return'. </p>
  
  <p>I thought it could be accomplished like this...</p>
  
  <pre><code>df["log_ret"] = df[df["instrument_holding"] + "_return"]
  </code></pre>
  
  <p>That is not the case. Thanks for any suggestions!</p>