title: How to Remove outlier from DataFrame using IQR?
body: <p>I Have Dataframe with a lot of columns (Around 100 feature), I want to apply the interquartile method and wanted to remove the outlier from the data frame.</p>
  
  <p>I am using this link
  <a href="https://stackoverflow.com/questions/34782063/how-to-use-pandas-filter-with-iqr">stackOverflow</a></p>
  
  <p>But the problem is nan of the above method is working correctly,</p>
  
  <p>As I am trying like this</p>
  
  <pre><code>Q1 = stepframe.quantile(0.25)
  Q3 = stepframe.quantile(0.75)
  IQR = Q3 - Q1
  ((stepframe &lt; (Q1 - 1.5 * IQR)) | (stepframe &gt; (Q3 + 1.5 * IQR))).sum()
  </code></pre>
  
  <p>it is giving me this</p>
  
  <pre><code>((stepframe &lt; (Q1 - 1.5 * IQR)) | (stepframe &gt; (Q3 + 1.5 * IQR))).sum()
  Out[35]: 
  Day                      0
  Col1                     0
  Col2                     0
  col3                     0
  Col4                     0
  Step_Count            1179
  dtype: int64
  </code></pre>
  
  <p>I just wanted to know that, What I will do next so that all the outlier from the data frame will be removed.</p>
  
  <p>if i am using this </p>
  
  <pre><code>def remove_outlier(df_in, col_name):
  q1 = df_in[col_name].quantile(0.25)
  q3 = df_in[col_name].quantile(0.75)
  iqr = q3-q1 #Interquartile range
  fence_low  = q1-1.5*iqr
  fence_high = q3+1.5*iqr
  df_out = df_in.loc[(df_in[col_name] &gt; fence_low) &amp; (df_in[col_name] &lt; fence_high)]
  return df_out
  
  re_dat = remove_outlier(stepframe, stepframe.columns)
  </code></pre>
  
  <p>I am getting this error</p>
  
  <pre><code>ValueError: Cannot index with multidimensional key
  </code></pre>
  
  <p>in this line </p>
  
  <pre><code>    df_out = df_in.loc[(df_in[col_name] &gt; fence_low) &amp; (df_in[col_name] &lt; fence_high)]
  </code></pre>