title: Applying series of conditions to dataframe. Pandas
body: <p>I used to work with np.where function when applying  multiple conditions to dataframe and feel ok in using it.
  I would like to improve my code where the same condition is repeated in each set of conditions in np.where and I do not know how to do it in  most simple (clear and concise manner), either using (1) <strong>.loc</strong> or (2) <strong>IF</strong> "condition" <strong>DO</strong> " apply other conditions"</p>
  
  <p>Example:</p>
  
  <p>I need to select only rows where "Date" is under condition (eg. >20200201) and only for these rows, calculate new column, applying another set of different conditions (eg. condition 1: A >20 and B >20; condition 2: A==30 and B==10, condition 3: A==20 and B>=10 etc)</p>
  
  <p>My question what will be <strong>the best way</strong> to make the first selection (Data >20200202)  to not repeat Date>2020201 in every line and avoid this:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  df = pd.DataFrame({"ID": [1,3,2,2,3,1,3,2],
             "Date": [20200109, 20200204, 20200307, 20200216, 20200107, 20200108, 20200214, 20200314],
             "A": [20,10,40,40,10,20, 40,30], 
             "B": [20,30,40,50,20, 30, 20, 10]})
  
  df['new']=np.nan
  df['new']=np.where((df['Date']&gt;20200201) &amp; (df['A']&gt;20) &amp; (df['B']&gt;20), 'value', df['new'])
  df['new']=np.where((df['Date']&gt;20200201) &amp; (df['A']==30) &amp; (df['B']==10), 'value', df['new'])
  df['new']=np.where((df['Date']&gt;20200201) &amp; (df['A']==20) &amp; (df['B']&gt;=10), 'value', df['new'])
  </code></pre>