pola-rs / polars-xdt

Polars plugin offering eXtra stuff for DateTimes
https://marcogorelli.github.io/polars-xdt-docs/
MIT License
187 stars 8 forks source link

Outdated exception message and unreachable code using offset_by's roll argument #32

Closed SebastienFries closed 11 months ago

SebastienFries commented 11 months ago

In version 3.16, the offset_by takes roll as argument but:

import polars as pl
import polars_business as plb
import datetime

df = pl.DataFrame({
"date": pl.date_range(datetime.date(2023,12,1), datetime.date(2023,12,5), eager=True)
})

df.with_columns(pl.col("date").bdt.offset_by("1bd"))  # this will return the outdated exception message

df.with_columns(pl.col("date").bdt.offset_by("1bd", roll="forward"))  # this will work as expected

df.with_columns(pl.col("date").bdt.offset_by("1bd", roll="cabbage"))  # this will enter unreachable code
MarcoGorelli commented 11 months ago

thanks @SebastienFries for the report, this is fixed in the latest version (0.3.18)