title: multiple if else conditions in pandas dataframe and derive multiple columns
body: <p>I have a dataframe like below.</p>
  <pre><code>import pandas as pd
  import numpy as np
  raw_data = {'student':['A','B','C','D','E'],
          'score': [100, 96, 80, 105,156], 
      'height': [7, 4,9,5,3],
      'trigger1' : [84,95,15,78,16],
      'trigger2' : [99,110,30,93,31],
      'trigger3' : [114,125,45,108,46]}
  
  df2 = pd.DataFrame(raw_data, columns = ['student','score', 'height','trigger1','trigger2','trigger3'])
  
  print(df2)
  </code></pre>
  <p>I need to derive Flag column based on multiple conditions.</p>
  <p>i need to compare score and height columns with trigger 1 -3 columns.</p>
  <p>Flag Column:</p>
  <ol>
  <li><p>if Score greater than equal trigger 1 and height less than 8 then Red --</p>
  </li>
  <li><p>if Score greater than equal trigger 2 and height less than 8 then Yellow --</p>
  </li>
  <li><p>if Score greater than equal trigger 3 and height less than 8 then Orange --</p>
  </li>
  <li><p>if height greater than 8 then leave it as blank</p>
  </li>
  </ol>
  <p>How to write if else conditions in pandas dataframe and derive columns?</p>
  <p>Expected Output</p>
  <pre><code>  student  score  height  trigger1  trigger2  trigger3    Flag
  0       A    100       7        84        99       114  Yellow
  1       B     96       4        95       110       125     Red
  2       C     80       9        15        30        45     NaN
  3       D    105       5        78        93       108  Yellow
  4       E    156       3        16        31        46  Orange
  </code></pre>
  <p>For other column Text1 in my original question I have tried this one but the integer columns not converting the string when concatenation using astype(str) any other approach?</p>
  <pre><code>def text_df(df):
  
      if (df['trigger1'] &lt;= df['score'] &lt; df['trigger2']) and (df['height'] &lt; 8):
          return df['student'] + &quot; score &quot; + df['score'].astype(str) + &quot; greater than &quot; + df['trigger1'].astype(str) + &quot; and less than height 5&quot;
      elif (df['trigger2'] &lt;= df['score'] &lt; df['trigger3']) and (df['height'] &lt; 8):
          return df['student'] + &quot; score &quot; + df['score'].astype(str) + &quot; greater than &quot; + df['trigger2'].astype(str) + &quot; and less than height 5&quot;
      elif (df['trigger3'] &lt;= df['score']) and (df['height'] &lt; 8):
          return df['student'] + &quot; score &quot; + df['score'].astype(str) + &quot; greater than &quot; + df['trigger3'].astype(str) + &quot; and less than height 5&quot;
      elif (df['height'] &gt; 8):
          return np.nan
  </code></pre>