📜  numpy rolling 2d - Python 代码示例

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

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