Open MarcusJellinghaus opened 7 months ago
Or is it an issue with the code?
(pl.Null
in the code is "wrong" but not the problem.)
It just seems .set()
is not yet supported for Date/Datetime Series.
pl_series_datetime.set(pl_series_datetime.dt.year() < 1753, None)
# NotImplemented
If we test Int:
pl_series_datetime.cast(int).set(pl_series_datetime.dt.year() < 1753, None)
# shape: (2,)
# Series: 'date' [i64]
# [
# null
# -78892
# ]
Thank you for the clarification :-)
Would it make sense to support .set()
for Date/DateTime Series?
As an enhancement idea?
You can shift the paradigm to when-then-otherwise
as set
is a little anti-pattern, and will block optimizations like predicate pushdown...
pl_series_datetime = pl.Series("date", [datetime.date(1751, 1, 1), datetime.date(1754, 1, 1)])
pl.select(pl.when(pl_series_datetime.dt.year() < 1753).then(None).otherwise(pl_series_datetime))
shape: (2, 1)
┌────────────┐
│ literal │
│ --- │
│ date │
╞════════════╡
│ null │
│ 1754-01-01 │
└────────────┘
Checks
Reproducible example
results in
NotImplementedType
Log output
Issue description
pl_series_datetime.set( pl_series_datetime.dt.year() < 1753, pl.Null)
should return a seriesExpected behavior
The result should match
Installed versions