I was given a dataset like this:
index value
1 2.5
2 3.7
3 2.0
4 4.0
5 6.5
6 1.6
7 3.9
... ...
I need to transfer the data into this form:
index value1 value2 value3
1 2.5 3.7 2.0
2 3.7 2.0 4.0
3 2.0 4.0 6.5
4 4.0 6.5 1.6
5 6.5 1.6 3.9
... ... ...
Is there any way to do this efficiently? This is a sample of the data, I would have to move like a window of 20 rows of data, and do this process to fill the dataset sequentially.
Thanks!