-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
docs(python): Add example for index count in DataFrame.rolling
#16600
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16600 +/- ##
==========================================
+ Coverage 81.51% 81.52% +0.01%
==========================================
Files 1414 1414
Lines 185906 186398 +492
Branches 3027 3014 -13
==========================================
+ Hits 151535 151966 +431
- Misses 33840 33902 +62
+ Partials 531 530 -1 ☔ View full report in Codecov by Sentry. |
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 Maren! I think your choice of numbers makes the example quite self-explanatory
just got a minor comment
py-polars/polars/dataframe/frame.py
Outdated
@@ -5719,6 +5719,24 @@ def rolling( | |||
│ 2020-01-03 19:45:32 ┆ 11 ┆ 2 ┆ 9 │ | |||
│ 2020-01-08 23:16:43 ┆ 1 ┆ 1 ┆ 1 │ | |||
└─────────────────────┴───────┴───────┴───────┘ | |||
|
|||
The index count is based on actual values in a defined column and not on |
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.
How about
If you use an index count in `period` or `offset`, then it's based on the values in `index_column`:
< your example goes here >
If you want it to be based on row number, then you may want to combine `rolling` with :meth:`.with_row_index`
?
DataFrame.rolling
DataFrame.rolling
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.
nice one, thanks @marenwestermann !
towards #14781
I think this closes the issue, right? or is there anything else that needs doing for that one?
towards #14781
I added an example for using the index count in
DataFrame.rolling
as there has been unclarity about how exactly it works.