title: Remove values above threshold
body: <p>I'm trying to remove values from a dataframe, which is temperature some values are 10.0, 10.5,40.0, but I have values which don't make sense like 140.0, 159.5.. which I wanna remove.
  I use the following functions but I don't get any thing to be removed like the indices</p>
  
  <pre><code>def remove_outlier(df, col_name):
      threshold = 100.0  # Anything that occurs abovethan this will be removed.
      value_counts = df.stack().value_counts()  # Entire DataFrame
      to_remove = value_counts[value_counts &gt;= threshold].index
      if(len(to_remove) &gt; 0):
          df[col_name].replace(to_remove, np.nan)
      return df
  </code></pre>