childmindresearch / wristpy

https://childmindresearch.github.io/wristpy/
GNU Lesser General Public License v2.1
2 stars 1 forks source link

Task: Consider switching moving_* to polars functions. #39

Open ReinderVosDeWael opened 3 months ago

ReinderVosDeWael commented 3 months ago

We could consider switching these to e.g.

def rolling_median(arr, window_size):
  df = pl.DataFrame(arr)
  rolling_median = df.select([
        pl.col("*").rolling_mean(window_size)
    ])
  return np.array(rolling_median)

Original comment by Florian:

Why not use https://docs.pola.rs/py-polars/html/reference/expressions/api/polars.Expr.rolling_median.html and other polars.rolling_* methods instead of implementing all of these?

Originally posted by @nx10 in https://github.com/childmindresearch/wristpy/issues/38#issuecomment-2112656349