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

docs(python): Add example for index count in DataFrame.rolling #16600

Merged
merged 4 commits into from
Jun 4, 2024

Conversation

marenwestermann
Copy link
Contributor

towards #14781

I added an example for using the index count in DataFrame.rolling as there has been unclarity about how exactly it works.

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars rust Related to Rust Polars labels May 30, 2024
Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.52%. Comparing base (d7b4f72) to head (05a6232).
Report is 17 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@MarcoGorelli MarcoGorelli left a 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

@@ -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
Copy link
Collaborator

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`

?

@stinodego stinodego changed the title docs: add example for index count in DataFrame.rolling docs(python): Add example for index count in DataFrame.rolling May 30, 2024
@stinodego stinodego removed rust Related to Rust Polars labels May 30, 2024
Copy link
Collaborator

@MarcoGorelli MarcoGorelli left a 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?

@ritchie46 ritchie46 merged commit 2425577 into pola-rs:main Jun 4, 2024
14 checks passed
@marenwestermann marenwestermann deleted the rolling-docs branch June 4, 2024 19:11
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants