title: Create new columns based on multiple conditions in Python
body: <p>I have the following dataframe: </p>
  
  <pre><code>  data = [
  (27450, 27450, 29420,"10/10/2016"),
  (29420 , 36142, 29420, "10/10/2016"),
  (11 , 11, 27450, "10/10/2016")] 
  
  #Create DataFrame base
  df = pd.DataFrame(data, columns=("User_id","Actor1","Actor2", "Time"))
  </code></pre>
  
  <p>The first column contains the user_id, and each line represents one action that he makes. Each user_id shows up either in "Actor1" or "Actor2" column. </p>
  
  <p>First, I would like to create a new column where it will assign the value 1 if the user_id is found in "Actor1" column and 0 otherwise. </p>
  
  <p>Second, I would like to create a new column where for each user_id it will store the "Actor"_i value that he interacted with. </p>
  
  <p>For the above example, the output will look like:</p>
  
  <pre><code>   Col1  Col2    
      1    29420    
      0    36142    
      1    27450    
  </code></pre>
  
  <p>What is the most efficient pythonic way to do this?</p>
  
  <p>Thanks a lot in advance!</p>