title: python pandas: lookup value in one column conditioned on other column
body: <p>I have the following df:</p>
  
  <pre><code>Customer | transaction_id | medium   | first_transaction_flag
  ABC        12345            organic      Y                      
  ABC        23456            email        0                      
  ABC        34567            organic      0                                   
  BCD        45678            organic      0                      
  BCD        56789            referral     0                      
  </code></pre>
  
  <p>I need to add a column with the actual first medium. This is the end product I am looking for:</p>
  
  <pre><code>Customer | transaction_id | medium   | first_transaction_flag | first_medium
  ABC        12345            organic      Y                      organic
  ABC        23456            email        0                      organic                
  ABC        34567            organic      0                      organic                          
  BCD        45678            organic      0                      0           
  BCD        56789            referral     0                      0
  </code></pre>
  
  <p>Basically, whatever is the value in the "medium" column for a transaction that has "first_transaction_flag" = Y, copy that value for all transactions for that client in the "first_medium" column. </p>
  
  <p>I think I'm really close to solving it with the help of one of @piSquared previous answer's. </p>
  
  <pre><code>df['first_medium'] = df.lookup(df.Customer, df.medium)
  </code></pre>
  
  <p>But not sure how to combine this with a np.where statement for first_transaction_flag =='Y'</p>
  
  <p>So sorry if this was asked before, I couldn't find it </p>