Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Make groupby rolling/dynamic iterable #6372

Merged
merged 5 commits into from
Jan 22, 2023

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jan 22, 2023

Resolves #5786

Question: while working on this, I noticed that groupby_rolling defaults to closed=left, while groupby_dynamic defaults to closed=right. Why is this? It would make sense to me to have both default to closed=left.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Jan 22, 2023
@stinodego stinodego marked this pull request as draft January 22, 2023 14:57
@stinodego stinodego marked this pull request as ready for review January 22, 2023 15:02
@zundertj
Copy link
Collaborator

zundertj commented Jan 22, 2023

In finance applications, where typically you have a backward (in time) looking window, you would want closed="right" to be the default imo. See for example Pandas doing the same with rolling_mean.

@ritchie46
Copy link
Member

For groupby rolling I believe it was most intuitive as then each row is the first element of its respective group. In groupby dynamic we don't have this direct row 1:1 mapping.

@ritchie46
Copy link
Member

Nice one. I can imagine this being useful for ergonomics on smallish data.

@ritchie46 ritchie46 merged commit 2bbdb3a into pola-rs:master Jan 22, 2023
@drivenow
Copy link

drivenow commented Feb 3, 2023

@zundertj @ritchie46 Do you think it's suitable to use rs-polars in high frequency market data indicators calculation? which features streaming Calculation and extreme low latency.

@stinodego stinodego deleted the iter-groupby-rolling-dynamic branch February 22, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Iterable groupby_rolling and groupby_dynamic
4 participants