Show HN: Fast Rolling Quantiles for Python
github.com
github.com
The README mentions it uses binary heaps - if you’re willing to accept some (bounded) approximation, then it should be possible to reduce memory usage and somewhat reduce runtime by using a sketching data structure like Dunning’s t-digest: https://github.com/tdunning/t-digest/blob/main/docs/t-digest....
There is an open source Python implementation, although I haven’t used it and can’t vouch for its quality: https://github.com/CamDavidsonPilon/tdigest
import numpy as np
import pandas as pd
s_input = pd.Series(np.random.randn(1000))
s_p10 = s_input.rolling(10).quantile(0.1)