Sliding window iterator using rolling in pandas

后端 未结 2 1946
离开以前
离开以前 2021-01-13 06:25

If it\'s single row, I can get the iterator as following

import pandas as pd
import numpy as np

a = np.zeros((100,40))
X = pd.DataFrame(a)

for index, row i         


        
2条回答
  •  被撕碎了的回忆
    2021-01-13 07:08

    That's not how rolling works. It "provides rolling transformations" (from the docs).

    You can loop and use pandas indexing?

    for i in range((X.shape[0] + 9) // 10):
        X_subset = X.iloc[i * 10: (i + 1) * 10])
    

提交回复
热议问题