-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Allow for rolling_*_by to use index count as window #19071
Conversation
292c025
to
a0ed213
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19071 +/- ##
=======================================
Coverage 79.77% 79.77%
=======================================
Files 1531 1531
Lines 208500 208505 +5
Branches 2913 2913
=======================================
+ Hits 166322 166326 +4
- Misses 41627 41628 +1
Partials 551 551 ☔ View full report in Codecov by Sentry. |
def test_rolling_by_integer(dtype: PolarsDataType) -> None: | ||
df = pl.DataFrame({"val": [1, 2, 3]}).with_row_index() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I missing something or is the parameterized dtype
never used?
Shouldn't it be something like this:
df = pl.DataFrame({"val": [1, 2, 3]}, schema={"val": dtype}).with_row_index()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @HansBambel , the intention was probably
df = pl.DataFrame({"val": [1, 2, 3]}).with_row_index().with_columns(pl.col('index').cast(dtype))
fancy making a pr to address this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarcoGorelli I'll do that on the weekend at the latest!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Managed to do it now already: #19555
Local tests were failing because connectorx
was missing even after running make requirements-all
. Not sure why
example:
which
DataFrame.rolling
already supportsIt should be possible for both
Expr.rolling_*_by
andDataFrame.rolling
to support Duration and Time too, but i'll keep that separate