Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork18.5k
Description
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
In a current project, I iterate overdf.rolling(window).cov(pairwise=True)
. Currently, I back-calculate from the index value of the cov() and the window offset what I suspect to be the start of the window. Then I slice the original df again into the window.
It would be great to iterate efficiently over the original df simultaneously with the cov values (and possibly with all the other window functions).
Feature Description
An idea off the top off my head:
for window, cov in df.rolling(window).roll("window", "cov_pairwise"): ... # window equals df.loc[start:end] # cov equals df.loc[start:end].cov() # start equals window.index[0] # end equals window.index[-1] ...
Alternative Solutions
I don't know any. Maybe there is already a way to do this.
Additionally,roll
could allow efficient slicing to avoid useless calculations
for window, cov in df.rolling(window).roll("window", "cov_pairwise")[-1000:]: ...
Additional Context
No response