Closed pietroppeter closed 1 month ago
ah I found the workaround that works:
df.with_columns(df.get_column("isoweek").iwd.isoweek_to_datetime().alias("week_date"))
Ciao Pietro!
That's certainly a bug. Everything that works with series' should work with expr's as well.
I wonder if the extensions registration ends in some kind of conflict:
@pl.api.register_series_namespace("iwd")
@pl.api.register_expr_namespace("iwd")
class SeriesIsoWeek(Generic[T]):
...
I will investigate this further.
Could you please share the polars version you are using?
Ignore all previous considerations. The error
TypeError: the truth value of an Expr is ambiguous
is triggered in the line:
return series.str.extract(pattern).is_not_null().all()
which for Expr seems to cause issues. I will think how to deal with this (most likely with a duck-typing approach)
@pietroppeter should be fixed in v1.4.0
Will check and report back
I am trying to use
isoweek_to_datetime
in a dataframe to generate a new column, it seems the function is not working in awith_columns
context.Reproducible example (adapted from docs and generated by exporting a jupyter notebook to markdown):
workaround:
(note that the workaround does not work)