Skip to content

Commit

Permalink
depr(python): Make some parameters of dt.add_business_days keyword-…
Browse files Browse the repository at this point in the history
…only (#19428)
  • Loading branch information
eitsupi authored Oct 24, 2024
1 parent 1452468 commit a08b513
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions py-polars/polars/expr/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import polars._reexport as pl
from polars import functions as F
from polars._utils.convert import parse_as_duration_string
from polars._utils.deprecation import deprecate_function
from polars._utils.deprecation import deprecate_function, deprecate_nonkeyword_arguments
from polars._utils.parse import parse_into_expression
from polars._utils.unstable import unstable
from polars._utils.wrap import wrap_expr
Expand Down Expand Up @@ -35,6 +35,7 @@ class ExprDateTimeNameSpace:
def __init__(self, expr: Expr) -> None:
self._pyexpr = expr._pyexpr

@deprecate_nonkeyword_arguments(allowed_args=["self", "n"], version="1.12.0")
def add_business_days(
self,
n: int | IntoExpr,
Expand Down Expand Up @@ -97,7 +98,9 @@ def add_business_days(
You can pass a custom weekend - for example, if you only take Sunday off:
>>> week_mask = (True, True, True, True, True, True, False)
>>> df.with_columns(result=pl.col("start").dt.add_business_days(5, week_mask))
>>> df.with_columns(
... result=pl.col("start").dt.add_business_days(5, week_mask=week_mask)
... )
shape: (2, 2)
┌────────────┬────────────┐
│ start ┆ result │
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/series/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def add_business_days(
You can pass a custom weekend - for example, if you only take Sunday off:
>>> week_mask = (True, True, True, True, True, True, False)
>>> s.dt.add_business_days(5, week_mask)
>>> s.dt.add_business_days(5, week_mask=week_mask)
shape: (2,)
Series: 'start' [date]
[
Expand Down

0 comments on commit a08b513

Please sign in to comment.