Mar-28-2020, 02:35 PM
Dear all i have an Array A
A=[0 1 2 3 4 5 6 7 8 9 10 ... 200]
from this array i would like to make a matrix B (pandas dataframe) where each row of B will equal 3 sequential data points from A
i.e.
B[0]=0 1 2
B[1]=1 2 3
B[2]=2 3 4
B[3]=3 4 5
...
B[197]=197 188 199
B[198]=198 199 200
I failed to do it with .loc and for loops due to indexing problems. Can someone help me?
Thanks in advance!
A=[0 1 2 3 4 5 6 7 8 9 10 ... 200]
from this array i would like to make a matrix B (pandas dataframe) where each row of B will equal 3 sequential data points from A
i.e.
B[0]=0 1 2
B[1]=1 2 3
B[2]=2 3 4
B[3]=3 4 5
...
B[197]=197 188 199
B[198]=198 199 200
I failed to do it with .loc and for loops due to indexing problems. Can someone help me?
Thanks in advance!