title: Populating a new column in a dataframe based on multi-level condititionals
body: <p>I am trying to populate a column ['Mod_unMod'] based on multiple conditions from other columns in my dataframe (<code>'cnms_df'</code>). I wrote some <code>pseudo-code</code> to explain the difficulty:</p>
  
  <pre><code>IF (cnms_df['CA'] = "NO"):
      IF (cnms_df['I'] ="X" OR cnms_df['I']="V" OR cnms_df['I']="VE" OR cnms_df['I']="0.2 PCT ANNUAL CHANCE FLOOD HAZARD" OR cnms_df['I']="AREA NOT INCLUDED")
          cnms_df['Mod_unMod'] = "UnMapped"
      ELSE IF (LEFT(cnms_df['STUDY_TYPE].str[:3])="NON")
          cnms_df['Mod_unMod'] ="NON"
  
      ELSE IF (cnms_df['BJ']="X" OR cnms_df['BJ']="V" OR cnms_df['BJ']="V" OR cnms_df['BJ']="VE" OR cnms_df['BJ']="0.2 PCT ANNUAL CHANCE FLOOD HAZARD" OR cnms_df['BJ']="AREA NOT INCLUDED")   
          cnms_df['Mod_unMod']
      ELSE IF (LEFT(BK2,3)="NON" 
          cnms_df['Mod_unMod']="UnMod"
      ELSE:
          cnms_df['Mod_unMod']="Modernized")
  ELSE:
      cnms_df['Mod_unMod'] = "UnMapped"    
  </code></pre>
  
  <p>I have applied simple <code>np.where</code> statements, but I am not sure how I could do this with the above levels. Is there a way to do something like this, in a logical fashion?</p>
  
  <pre><code>cnms_df['Mod_unMod'] = np.where((cnms_df['CA'] == 'No') &amp; ((cnms_df['I'] ="X") | (cnms_df['I']="V") | (cnms_df['I']="VE") | (cnms_df['I']="0.2 PCT ANNUAL CHANCE FLOOD HAZARD") | (cnms_df['I']="AREA NOT INCLUDED")), "UnMapped", "Modernized")
  </code></pre>