explorer
explorer copied to clipboard
Allow operation between Series and LazySeries
- [ ] Series + LazySeries -> LazySeries
- [x] LazySeries + Series -> LazySeries
The code below should work.
df = Explorer.DataFrame.new(%{a: [1, 2, 3]})
df
|> Explorer.DataFrame.mutate_with(&%{
b: Explorer.Series.add(&1[:a], Explorer.Series.from_list([1, 2, 3])),
c: Explorer.Series.add(Explorer.Series.from_list([1, 2, 3]), &1[:a])
})
Reference: https://github.com/pola-rs/polars/pull/4988
Let me try to handle this issue
Hmm.. maybe I misunderstood the reference PR.
For the arithmetic operations, polars do series + expr -> series. right?
I need to check series + expr -> expr, expr + series -> expr works in polars first.
@nallwhy I think you need to transform the series to a literal value expression first. Maybe https://docs.rs/polars/latest/polars/series/struct.Series.html#method.lit does the trick, but I'm not sure.
@philss Thanks! It works :)