title: Pandas element wise if/else (IIF)
body: <p>Is there a element-wise IIF function in Pandas? </p>
  
  <p>E.g. given a dataframe:</p>
  
  <pre><code>w = pd.DataFrame({'Date':pd.to_datetime(['2016-01-01','2016-01-02','2016-01-03']),'A1':[0.3,0.1,0.1],'A2':[0.4,0.4,0.4]}).set_index(['Date'])  
  </code></pre>
  
  <p>If the element > 0.2, set to 1, else set to 0. Such as below:</p>
  
  <pre><code>w2 = pd.DataFrame({'Date':pd.to_datetime(['2016-01-01','2016-01-02','2016-01-03']),'A1':[1,0,0],'A2':[1,1,1]}).set_index(['Date'])  
  </code></pre>
  
  <p>There is mask()/where(), but the true value is from the old dataframe. </p>