I have a data frame similar to this:
df = pd.DataFrame({'B': [0, 1, 2, 3, 4]})
I want to use rolling function in pandas, but I don't need the aggregated function (sum, mean, min, max,...) after rolling. I need data for each window.
I can develop a sliding window myself, but my question is about rolling function. is it possible to have something similar to this by using rolling function in pandas.
when I use the following function
w = df.rolling(2)
I received the following result:
Rolling [window=2,center=False,axis=0]
while I need this:
w = [[0 , 1]
[1 , 2]
[2 , 3]
[3 , 4]]