📜  numpy rolling - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:25.507000             🧑  作者: Mango

代码示例1
def rolling_window(a, window):
    shape = a.shape[:-1] + (a.shape[-1] - window + 1, window)
    strides = a.strides + (a.strides[-1],)
    return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)