I have a dataset and what I want is. Lets say I am in the row with index 4, I want to get the past 4 candles and insert their values into the row which I am. Like this:
open_close close_open open_high open_low close_high close_low close out
0 0.0000 0.0000 0.0000 0.0002 0.0000 0.0002 0.6114 1
1 -0.0001 0.0001 -0.0002 0.0003 -0.0001 0.0004 0.6114 0
2 -0.0001 0.0001 -0.0002 0.0001 -0.0001 0.0002 0.6113 1
3 0.0001 -0.0001 0.0000 0.0003 -0.0001 0.0002 0.6114 1
4 0.0000 0.0000 0.0000 0.0002 0.0000 0.0002 0.6115 0
5 0.0002 -0.0002 0.0000 0.0002 -0.0002 0.0000 0.6113 1
6 0.0000 0.0000 0.0000 0.0002 0.0000 0.0002 0.6115 1
7 0.0000 0.0000 -0.0001 0.0002 -0.0001 0.0002 0.6115 1
8 0.0002 -0.0002 0.0000 0.0003 -0.0002 0.0001 0.6115 1
9 0.0001 -0.0001 0.0000 0.0003 -0.0001 0.0002 0.6117 1
SO it will be:
open_close0 open_close1 open_close2 open_close3 open_close close_open open_high open_low close_high close_low close out
4 0.0000 -0.0001 -0.0001 0.0001 0.0000 0.0000 0.0000 0.0002 0.0000 0.0002 0.6115 0
It follows the same logic for all rows, and I wanted to do this with all columns except the "out" column. Is there any function in pandas that facilitates this?