title: Replacing dataframe values with NaN based on condition while preserving shape of df
body: <p>Python newbie here. I am sure I'm asking a trivial question but after doing a bit of google-foo I unfortunately haven't figured out a solution. So here it goes:
  If I have a dataframe such as this:</p>
  
  <pre><code>raw_data = {'first_name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 
      'last_name': ['Miller', 'Jacobson', 'Ali', 'Milner', 'Cooze'], 
      'age': [42, 52, 36, 24, 73], 
      'preTestScore': [-999, -999, -999, 2, 1],
      'postTestScore': [2, 2, -999, 2, -999]}
  df = pd.DataFrame(raw_data, columns = ['first_name', 'last_name', 'age', 'preTestScore', 'postTestScore'])
  </code></pre>
  
  <p>How do I go about performing the following action:
  if preTestScore = -999, then replace both preTestScore and postTestScore with NaN?</p>
  
  <p>I am able to replace a single column value with NaN by using df.replace(-999, np.nan) but this requires a conditional removal across two columns.</p>
  
  <p>Thank you kindly</p>