title: How to give flag 2 if column x1 exist in dataframe and give flag 2.5 if column x2 exist in dataframe
body: <p>I am trying to add flag column in dataframe. i have dataframe with many columns. i want to add flag column for this i write this piece of code but its not working as i required. 
   i have two conditions one is if x1 column is exist in dataframe then give flag value '2' if x2 column exist in dataframe give flag value 2.5. the problem is when i run code its giving right flag 2 if x1 exist in column ,but when it find x2 exist in dataframe just give empty cell.</p>
  
  <pre><code>df['flag']=0
  if 'x1' in df:
              df['flag']=2.0
  if 'x2' in df:
              df['flag']=2.5
  </code></pre>