Pandas - Using `.rolling()` on multiple columns

前端 未结 2 807
庸人自扰
庸人自扰 2021-01-14 07:31

Consider a pandas DataFrame which looks like the one below

      A     B     C
0  0.63  1.12  1.73
1  2.20 -2.16 -0.13
2  0.97 -0.68  1.09
3 -0.         


        
2条回答
  •  北海茫月
    2021-01-14 08:20

    You can use numpy ravel. Still you may have to use for loops.

    for i in range(0,3):
        print(df.iloc[i:i+3].values.ravel())
    

    If your t steps in 3s, you can use numpy reshape function to create a n*9 dataframe.

提交回复
热议问题