1

In python we can do:

df.with_columns([
   pl.col("myCol").ewm_mean(50)
])

But how do we do the same in rust? The following doesn't work:

df.with_columns([
    col("myCol").ewm_mean(50)
])

It fails with No method named ewm_mean found in Expr.

While polars is great, the documentation for Rust is awful! I've tried searching to documentation, and all I can find is polars_arrow::kernels::ewm, but there is no human text in that area of the documentation. I've also tried looking at the python source to see if I can work down and figure out what it is doing but I can't trace it further back into PyExpr.

(I expect the 50 won't work either - I'm anticipating having to pass some sort of EWMOptions struct in the rust one, and have to calculate alpha rather than com. The python source that I can understand seems to calculate alpha first before switching to PyExpr)

Corvus
  • 7,548
  • 9
  • 42
  • 68

1 Answers1

1

Ok, so it turns out the above code will run, but it requires the ewma feature in the cargo.toml

Corvus
  • 7,548
  • 9
  • 42
  • 68