title: How to create new column in dataframe with more than condition while having ability to scale the conditions?
body: <p>I have a dataframe that looks like this: </p>
  
  <p>df:</p>
  
  <pre><code>name      date                         type
  apple     2018-01-01 00:00:00           a 
  banana    2018-08-18 00:00:00           b
  </code></pre>
  
  <p>How do I create a new column with a certain value based on multiple conditions from other columns? </p>
  
  <p>For example:</p>
  
  <p>If <code>name</code> column equals <code>apple</code>, and <code>date</code> column equals <code>today</code>, and <code>type</code> column equals <code>a</code> THEN new column <code>id</code> equals <code>1</code>. </p>
  
  <p>OR</p>
  
  <p>If <code>name</code> column equals <code>banana</code>, and <code>date</code> column equals <code>today</code>, and <code>type</code> column equals <code>b</code> THEN new column <code>id</code> equals <code>2</code>. </p>
  
  <p>new df will look like this:</p>
  
  <pre><code>name      date                         type       id
  banana    2018-08-18 00:00:00           b          2
  </code></pre>
  
  <p>I want to be able to add more clauses based on column values that are in the df later on, so looking for an approach that is scalable. </p>
  
  <p>currently I can do this with one column like so and one condition: </p>
  
  <pre><code>df.loc[df['name'].str.contains("Apple"),'id'] = 1
  </code></pre>
  
  <p>thank you in advance. </p>
  
  <p>edit: 
  have been trying this code but getting syntax error somewhere, not sure where. </p>
  
  <p>new_df = df[((df['name'].str.contains('apple')) &amp; (df['type'].str.contains('a')) &amp; ((df['date'] = today)))]</p>