'Eliminate outliers in a dataframe
If someone can help me with this:
I'm trying to use this formula to eliminate outliers, but when I do it
I got mistakes in "variable_filt" : ValueError: Can only compare identically-labeled DataFrame objects
code:
Q1 = variable.groupby(level='ETIQUETA').quantile(0.25)
Q3 = variable.groupby(level='ETIQUETA').quantile(0.75)
IQR = Q3 - Q1
variable_filt = variable[~((variable< (Q1 - 1.5 * IQR)) |(variable > (Q3 + 1.5 * IQR))).any(axis=1)]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
