Detect outliers by running a median filter (which is robust to outliers) and computing residuals. The quantiles of those residuals are computed and then individual time points are rejected if the residual at that time point is more than level times the specified quantile. So if level is 4, the median residual is 1, the 0.25 is -6, the quantile 0.75 quantile is 8, any time point with a residual more than:
1+4*(8-1) = 29
or less than 1 - 4(1 - (-6)) = -27 would be rejected
quantiles: lower and upper quantiles. Middle one is filled with 0.5.
filt_len: length of median filter, default is 5
copy: if True, a copy is made leaving original series intact
You can also specify rejection of values based on a simple range
Returns: copy of series with outliers replaced by nan