window = 2

def get_3d_shfted_array(df, window=window):
    rows = df.values
res = np.dstack(rows[i:i - window] for i in range(window))
return res
res = get_3d_shfted_array(df)
zero = res[..., (0)]
one = res[..., (1)]

def get_multiindexed_array(df, window=window):
    return pd.concat([df, df.shift(-1)], axis=1, keys=[0, 1]).dropna()
dataframe representation of a rolling window