We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request for a rolling_top_k expression.
rolling_top_k
Currently, I can do this with very slow code using rolling_map and lambda.
rolling_map
lambda
data = data.with_columns( roll_top_k_mean = pl.col("a").rolling_map(lambda x: x.top_k(5).mean(), window_size=10) )
The method I hope to use is like:
data = data.with_columns( roll_top_k_mean = pl.col("a").rolling_top_k(k=5, w=10).mean() )
You can use 2 heaps and 1 queue to implement this.
The text was updated successfully, but these errors were encountered:
As an aside, I think the slow rolling_map can be replaced with Expr.rolling - right?
Expr.rolling
(data .with_row_index() .with_columns( pl.col("a").top_k(5).mean().rolling(index_column="index", period="5i") ) )
Sorry, something went wrong.
No branches or pull requests
Description
Request for a
rolling_top_k
expression.Currently, I can do this with very slow code using
rolling_map
andlambda
.The method I hope to use is like:
You can use 2 heaps and 1 queue to implement this.
The text was updated successfully, but these errors were encountered: