title: Pandas: replace list of values from list of columns
body: <p>I've got a many row, many column dataframe with different 'placeholder' values needing substitution (in a subset of columns). I've read many examples in the forum using nested lists or dictionaries, but haven't had luck with variations..</p>
  
  <pre><code># A test dataframe
  df = pd.DataFrame({'Sample':['alpha','beta','gamma','delta','epsilon'],
                    'element1':[1,-0.01,-5000,1,-2000], 
                    'element2':[1,1,1,-5000,2], 
                    'element3':[-5000,1,1,-0.02,2]})
  
  # List of headings containing values to replace
  headings = ['element1', 'element2', 'element3']
  </code></pre>
  
  <p>And I am trying to do something like this (obviously this doesn't work):</p>
  
  <pre><code> # If any rows have value &lt;-1, NaN
   df[headings].replace(df[headings &lt; -1], np.nan)
  
   # If a value is between -1 and 0, make a replacement
   df[headings].replace(df[headings &lt; 0 &amp; headings &gt; -1], 0.05)
  </code></pre>
  
  <p>So, is there possibly a better way to accomplish this using loops or fancy pandas tricks?</p>