Using Slice in Polars Rolling Agg #17198
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
python
Related to Python Polars
Checks
Reproducible example
Log output
Issue description
I was trying to slice a weight Series based on the length of the rolling window. Use cases can be e.g. we want to apply some custom weights for rolling average. (I understand there's already a rolling_mean implemented.)
Let's say my rolling window has a length of 5. The first 4 rows will have a length of 1, 2, 3, 4 and therefore I only want to get weights that fit the rolling window's length. From the fifth row on, I expect the weights to be always [.1, .2, .3, .4, .5].
Expected behavior
I ran the following code
I expect the following:
However what I got was:
When I extended my original df to 6 rows, I got the
PanicException: range end index 6 out of range for slice of length 5
exception in the log output above.Installed versions
The text was updated successfully, but these errors were encountered: