title: Replacing negative values in specific columns of a dataframe
body: <p>This is driving me crazy! I want to replace all negative values in columns containing string &quot;_p&quot; with the value multiplied by -0.5. Here is the code, where <code>Tdf</code> is a dataframe.</p>
  <pre><code>    L=list(Tdf.filter(regex='_p').columns)
      Tdf[L]=Tdf[L].astype(float)
      Tdf[Tdf[L]&lt;0]= Tdf[Tdf[L]&lt;0]*-.5  
  </code></pre>
  <p>I get the following error:</p>
  <p>&quot;TypeError: Cannot do inplace boolean setting on mixed-types with a non np.nan value&quot;</p>
  <p>I variefied that all columns in <code>Tdf[L]</code> are type float64.</p>
  <p>Even more confusing is that when I run a code, essentially the same except looping through multiple dataframes, it works:</p>
  <pre><code>csv_names=['Full','Missing','MinusMissing']
  
  for DF in csv_names:
      L=list(vars()[DF].iloc[:,1:])
      vars()[DF][L]=vars()[DF][L].astype(float)
      vars()[DF][vars()[DF][L]&lt;0]= vars()[DF][vars()[DF][L]&lt;0]*-.5  
  </code></pre>
  <p>What am I missing?</p>