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: support weekend argument in business_day_count #15544

Merged
merged 5 commits into from
Apr 10, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

part II of upstreaming business days to Polars

The "grand plan" is:

  • part III: add holidays argument to this function (this one may stir up a little more discussion)
  • part IV: add add_business_day, which would also take weekend and holidays arguments
  • part V: add is_business_day, which would also take weekend and holidays arguments (this one should be trivial)

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Apr 8, 2024
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 8, 2024 18:27
Copy link

codecov bot commented Apr 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.16%. Comparing base (33eedfb) to head (7635379).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15544      +/-   ##
==========================================
- Coverage   81.17%   81.16%   -0.02%     
==========================================
  Files        1367     1367              
  Lines      175313   175321       +8     
  Branches     2530     2530              
==========================================
- Hits       142314   142297      -17     
- Misses      32524    32550      +26     
+ Partials      475      474       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

from polars.type_aliases import IntoExprColumn
from polars.type_aliases import DayOfWeek, IntoExprColumn

DAY_NAMES = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this behind a cached function? Small things to keep import times down. ^^

Copy link
Collaborator Author

@MarcoGorelli MarcoGorelli Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks - I've ended up making it much simpler: users just pass an iterable of booleans, and that gets passed to the Rust side as-is

slightly less ergonomic perhaps, but I think realistically people would just define a constant with their week mask and pass that in, and the code's much simpler like this, sorry for having overcomplicated it

Copy link

codspeed-hq bot commented Apr 9, 2024

CodSpeed Performance Report

Merging #15544 will not alter performance

Comparing MarcoGorelli:business-week-mask (7635379) with main (b91dedb)

Summary

✅ 22 untouched benchmarks

@MarcoGorelli MarcoGorelli marked this pull request as draft April 9, 2024 08:08
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 9, 2024 08:47
@MarcoGorelli MarcoGorelli marked this pull request as draft April 9, 2024 18:20
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 9, 2024 20:01
@ritchie46 ritchie46 merged commit 82a12f5 into pola-rs:main Apr 10, 2024
25 checks passed
mbuhidar pushed a commit to mbuhidar/polars that referenced this pull request Apr 11, 2024
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 rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants