class_docstr: Handles/stores incoming dataset and provides window-based statistics.
  
  .. testcode::
      :skipif: True
  
      win_stats = WindowStat("level", 3)
      win_stats.push(5.0)
      win_stats.push(7.0)
      win_stats.push(7.0)
      win_stats.push(10.0)
      # Expect 8.0 as the mean of the last 3 values: (7+7+10)/3=8.0
      print(win_stats.mean())
  
  .. testoutput::
  
      8.0
docstr: Initializes a WindowStat instance.
  
  Args:
      name: The name of the stats to collect and return stats for.
      n: The window size. Statistics will be computed for the last n
          items received from the stream.
docstr_tok: ["Initializes","a","WindowStat","instance",".","Args",":","name",":","The","name","of","the","stats","to","collect","and","return","stats","for",".","n",":","The","window","size",".","Statistics","will","be","computed","for","the","last","n","items","received","from","the","stream","."]
code: def __init__(self, name: str, n: int):
      """Initializes a WindowStat instance.
  
      Args:
          name: The name of the stats to collect and return stats for.
          n: The window size. Statistics will be computed for the last n
              items received from the stream.
      """
      # The window-size.
      self.window_size = n
      # The name of the data (used for `self.stats()`).
      self.name = name
      # List of items to do calculations over (len=self.n).
      self.items = [None] * self.window_size
      # The current index to insert the next item into `self.items`.
      self.idx = 0
      # How many items have been added over the lifetime of this object.
      self.count = 0
  
file_path: ray/python/ray/rllib/utils/metrics/window_stat.py
imports: import numpy
label_desc: Use image node_id 1 to create a new WindowStat object  with example: obj = WindowStat(name, n)