After Python rolling_corr is canceled, what method should be used to deal with it?
As shown in the figure, I want to group by according to the code
column, and then calculate the corr
values of the 1
and 6
columns of each code every 10 days in units of 10 days. I don't know how to use one line (the error display may be because there is a null value in the middle).
CodePudding user response:
You have two ways to solve it
pd.Series(x).rolling(window=N).mean()
or
from scipy.ndimage.filters import uniform_filter1d
uniform_filter1d(x, size=N)