Skip to content

SortedWindow

Sorted running window data structure.

Parameters

  • size

    Typeint

    Size of the window to compute the rolling quantile.

Attributes

  • size

Examples

from river import utils

window = utils.SortedWindow(size=3)

for i in reversed(range(9)):
    print(window.append(i))
[8]
[7, 8]
[6, 7, 8]
[5, 6, 7]
[4, 5, 6]
[3, 4, 5]
[2, 3, 4]
[1, 2, 3]
[0, 1, 2]

Methods