This should be a replacement for the rolling function. Test with TSS
from scipy.ndimage import uniform_filter1d
if smoothing:
if rolling:
sample = sample.apply(lambda x:savgol_filter(x,window_length=21, polyorder=2))
sample = sample.apply(lambda x:x-uniform_filter1d(x, 200))
else:
sample = sample.apply(lambda x:savgol_filter(x,window_length=21, polyorder=2))
else:
if rolling:
sample = sample.apply(lambda x:x-uniform_filter1d(x, 200))
This should be a replacement for the rolling function. Test with TSS