Skip to content

Commit

Permalink
0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Oct 11, 2023
1 parent 81386cf commit 44d805c
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import polars as pl
from polars.type_aliases import IntoExpr
from polars.utils.udfs import _get_shared_lib_location

lib = _get_shared_lib_location(__file__)

__version__ = "0.1.1"


@pl.api.register_expr_namespace("bdt")
class BusinessDayTools:
def __init__(self, expr: pl.Expr):
self._expr = expr.cast(pl.Int32)


def advance_by_days(self, n) -> pl.Expr:
if not (isinstance(n, int) and n > 0):
raise ValueError("only positive integers are currently supported for `n`")

return self._expr._register_plugin(
lib=lib,
symbol="advance_by_days",
is_elementwise=True,
args = [n],
)

0 comments on commit 44d805c

Please sign in to comment.