3

I would like to compute the standard deviation (preferably) or the variance of a rolling trimmed mean. More precisely, I would like to have a rolling window, remove the bottom and top percentiles and compute the standard deviation.

So far I have succeeded only by using a for loop that integrates over many consecutive windows but it is too slow. I would like to have a line that does something like this for the mean:

window_length = 10
percentile = 0.1
df.rolling(window_length).apply(lambda x: trim_mean(x, percentile))
NC520
  • 346
  • 3
  • 13
  • check out @fuglede's answer [here](https://stackoverflow.com/questions/52135616/efficient-rolling-trimmed-mean-with-python/52136129#52136129) - may help – Chris Adams Jun 12 '19 at 14:50

0 Answers0