polars icon indicating copy to clipboard operation
polars copied to clipboard

feat(rust): Rolling kurtosis

Open VincentRoest opened this issue 3 years ago • 1 comments

This pull request is WIP for this feature request

I have some outstanding questions (I'm still learning)

  • I've modified the SumSquaresWindow to be more generic for multiple powers SumPowersWindow, but I'm not sure how I can parameterise the variable base that I use for the pow functionality. I'd like to have access to the base here

  • I'm using let one: T = NumCast::from(1).unwrap(); as constants for multiplying in the code, surely there's an easier way? here

Now, base = 2, so that the variance calculation doesn't break.

Let me know what you think :)

I'm thinking, am I implementing this in the right place? Maybe it's more like this;

ps sorry for the mess; had to cleanup my git settings and history :)

VincentRoest avatar Sep 19 '22 09:09 VincentRoest

I'm now getting the same results as pandas :)

import pandas as pd
df = pd.DataFrame({'B': [3, 1, 4, 1, 5, 9, 2]})
list(df.rolling(4, min_periods=4).kurt(fisher=True, bias=False)['B'])
>> [nan,nan,nan, -3.901234567901234, -4.858131487889274, 1.1656663364605784, -0.5818938605619142]

VincentRoest avatar Sep 19 '22 16:09 VincentRoest

I will close this as being stale.

ritchie46 avatar Jan 31 '23 06:01 ritchie46

Will there be no rolling_kurt in polars?

Franky1 avatar Feb 27 '24 21:02 Franky1

It would be very helpful if rolling_kurt could be added.

jackaixin avatar Jun 22 '24 04:06 jackaixin