title: Make NA based on condition in Pandas DF
body: <p>I feel like this probably has a simple solution, I just can't figure it out.</p>
  
  <p>I have a Pandas DF similar to this MWE:</p>
  
  <pre><code>In [92]: test_df = pd.DataFrame({'A': [1,2,3,4,5,6,7,8,9], 'B':[9,8,7,6,5,4,3,2,1]})
  
  In [93]: test_df
  Out[93]: 
     A  B
  0  1  9
  1  2  8
  2  3  7
  3  4  6
  4  5  5
  5  6  4
  6  7  3
  7  8  2
  8  9  1
  </code></pre>
  
  <p>What I want is to set all values in that df that are less than 4 to be <code>np.nan</code>. I can get a df of booleans for this criteria:</p>
  
  <pre><code>In [94]: test_df &lt; 4
  Out[94]: 
         A      B
  0   True  False
  1   True  False
  2   True  False
  3  False  False
  4  False  False
  5  False  False
  6  False   True
  7  False   True
  8  False   True
  </code></pre>
  
  <p>But I don't know the final step to make those True values <code>np.nan</code>. I thought this could be achieved with <code>test_df.loc</code> but I wasn't successful in my attempts.</p>