Pandas rolling window appears to introduce offset to rolled data

不羁的心 提交于 2019-12-10 09:33:18

问题


I am looking to 'smooth' regularly-sampled 30-sec time series data using the pandas rolling_window function, with a window type other than boxcar - ideally hamming. However, so far all windows which I have tried to apply, over varying window lengths from 2 to 100, appear to offset the smoothed data to lower values, e.g.:

Plot of raw data (light blue) and data run through pd.rolling_window(data,2,'hamming').

Clearly, the quantity of offset varies through time.

This result isn't what I would expect - rather, I'd expect the filtered dataset to sit atop the raw one.

Any explanations of what might be happening here would be great.


回答1:


Try the center=True argument to rolling_window.



来源:https://stackoverflow.com/questions/21332896/pandas-rolling-window-appears-to-introduce-offset-to-rolled-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!