问题
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