I've been trying to use Lazyframe
s instead of Dataframe
s more often due to performance reasons. Unfortunately, not all features available in DataFrame
s are available for LazyFrame
s, one of these being the .fill_null
method, that takes a FillNullStrategy
in the DataFrame
's method, but simply a generic E
where E: Into<Expr>
.
Today, I've tried extensively to replicate the same behavior of using a FillNullStrategy
for LazyFrame
to no avail with something like this:
lf.fill_null(
when(col("*").is_null())
.then(col("*").shift(Some(1)))
.otherwise(col(name)),
)
That didn't work when .collect()
ing the LazyFrame
, though.
I've noticed that we have such feature in Polars
Python
(docs), but not for Rust
. As I assume Polars team wouldn't expose such functionality simply by .collect()
ing the LazyFrame
and then .lazy()
ing it back, I believe I am missing something simpler here.
Does anybody have an insight on this?