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: add business_day_count function #15512

Merged
merged 3 commits into from
Apr 8, 2024
Merged

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented Apr 6, 2024

This is the most basic case: count the number of weekdays between two dates

I'd like to suggest starting with this one, and then considering the following as follow-ups:

  • add week_mask and holidays args
  • add add_business_day function
  • add is_business_day function

This functionality is pretty much a port of NumPy's busday_count, so as required I've included their license. Separate to this PR, but a few other licenses should probably be included too


status: I'm trying to sort out the structure, moving the implementation to polars-ops as that's where most functions seem to be implemented happy for this to be reviewed

@MarcoGorelli MarcoGorelli force-pushed the business branch 7 times, most recently from 083bc31 to 999a70c Compare April 6, 2024 23:09
Copy link

codecov bot commented Apr 7, 2024

Codecov Report

Attention: Patch coverage is 99.22481% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 81.14%. Comparing base (c211fad) to head (ff3bbd6).

❗ Current head ff3bbd6 differs from pull request most recent head 219227d. Consider uploading reports for the commit 219227d to get more accurate results

Files Patch % Lines
...ates/polars-plan/src/dsl/function_expr/business.rs 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15512      +/-   ##
==========================================
+ Coverage   81.12%   81.14%   +0.01%     
==========================================
  Files        1363     1368       +5     
  Lines      175161   175290     +129     
  Branches     2527     2527              
==========================================
+ Hits       142108   142244     +136     
+ Misses      32575    32568       -7     
  Partials      478      478              

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

@MarcoGorelli MarcoGorelli force-pushed the business branch 2 times, most recently from 0956d8c to 4c87c16 Compare April 7, 2024 10:55
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 7, 2024 11:11
@MarcoGorelli MarcoGorelli changed the title (wip) feat: add business_day_count function feat: add business_day_count function Apr 7, 2024
@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 7, 2024
@MarcoGorelli MarcoGorelli marked this pull request as draft April 7, 2024 16:09
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 7, 2024 18:44
@MarcoGorelli MarcoGorelli marked this pull request as draft April 7, 2024 20:03
@MarcoGorelli MarcoGorelli changed the title feat: add business_day_count function (wip) feat: add business_day_count function Apr 7, 2024
@MarcoGorelli MarcoGorelli changed the title (wip) feat: add business_day_count function feat: add business_day_count function Apr 8, 2024
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 8, 2024 08:32
Copyright (c) 2005-2023, NumPy Developers.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Copy link
Member

Choose a reason for hiding this comment

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

This could lead to problems as we want to distribute as MIT/Apache. But I also don't believe this required. You have interpreted their source code and written it as Rust. I think a link with credits should suffice.

@ritchie46 ritchie46 merged commit 2a42096 into pola-rs:main Apr 8, 2024
24 checks passed
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