class_docstr: Transformer that rolls a sliding window along a time series, and
  aggregates using a user-selected operation.
  
  Parameters
  ----------
  window: int or str
      Size of the rolling time window.
  
      - If int, it is the number of time point in this time window.
      - If str, it must be able to be converted into a pandas Timedelta
        object.
  
  agg: str or function
      Aggregation method applied to series.
      If str, must be one of supported built-in methods:
  
      - 'mean': mean of all values in a rolling window.
      - 'median': median of all values in a rolling window.
      - 'sum': summation of all values in a rolling window.
      - 'min': minimum of all values in a rolling window.
      - 'max': maximum of all values in a rolling window.
      - 'std': sample standard deviation of all values in a rolling window.
      - 'var': sample variance of all values in a rolling window.
      - 'skew': skewness of all values in a rolling window.
      - 'kurt': kurtosis of all values in a rolling window.
      - 'count': number of non-nan values in a rolling window.
      - 'nnz': number of non-zero values in a rolling window.
      - 'nunique': number of unique values in a rolling window.
      - 'quantile': quantile of all values in a rolling window. Require
        percentile parameter `q` in in parameter `agg_params`, which is a
        float or a list of float between 0 and 1 inclusive.
      - 'iqr': interquartile range, i.e. difference between 75% and 25%
        quantiles.
      - 'idr': interdecile range, i.e. difference between 90% and 10%
        quantiles.
      - 'hist': histogram of all values in a rolling window. Require
        parameter `bins` in parameter `agg_params` to define the bins. `bins`
        is either a list of floats, b1, ..., bn, which defines n-1 bins
        [b1, b2), [b2, b3), ..., [b{n-2}, b{n-1}), [b{n-1}, bn], or an
        integer that defines the number of equal-width bins in the range of
        input series.
  
      If function, it should accept a rolling window in form of a pandas
      Series, and return either a scalar or a 1D numpy array. To specify
      names of outputs, specify a list of strings as a parameter `names` in
      parameter `agg_params`.
  
      Default: 'mean'
  
  agg_params: dict, optional
      Parameters of aggregation function. Default: None.
  
  center: bool, optional
      Whether the calculation is at the center of time window or on the right
      edge. Default: False.
  
  min_periods: int, optional
      Minimum number of observations in window required to have a value.
      Default: None, i.e. all observations must have values.
code: def _predict_core(
      self, s: pd.Series
  ) -> Union[pd.Series, pd.DataFrame]:
      if not (
          s.index.is_monotonic_increasing
          or s.index.is_monotonic_decreasing
      ):
          raise ValueError(
              "Time series must have a monotonic time index. "
          )
  
      agg = self.agg
      agg_params = (
          self.agg_params if (self.agg_params is not None) else {}
      )
      window = self.window
      center = self.center
      min_periods = self.min_periods
      closed = self._closed
  
      rolling = s.rolling(
          window=window,
          center=center,
          min_periods=min_periods,
          closed=closed,
      )  # type: Union[pd.Series, pd.DataFrame]
  
      def getRollingVector(
          rolling: Union[pd.Series, pd.DataFrame],
          aggFunc: Any,
          output_names: List[str],
      ) -> Union[pd.Series, pd.DataFrame]:
          # we use this function to trick pandas to get vector rolling agg
          s_rolling_raw = []  # type: Union[List, np.array]
  
          def agg_wrapped(x: Any) -> int:
              s_rolling_raw.append(aggFunc(x))
              return 0
  
          s_rolling = rolling.agg(agg_wrapped)
          s_rolling_raw = np.array(s_rolling_raw)
          df = pd.concat([s_rolling] * s_rolling_raw.shape[1], axis=1)
          df[s_rolling.notna()] = s_rolling_raw
          s_rolling = df
          s_rolling.columns = output_names
          return s_rolling
  
      aggList = [
          "mean",
          "median",
          "sum",
          "min",
          "max",
          "quantile",
          "iqr",
          "idr",
          "count",
          "nnz",
          "nunique",
          "std",
          "var",
          "skew",
          "kurt",
          "hist",
      ]
      if agg in [
          "mean",
          "median",
          "sum",
          "min",
          "max",
          "count",
          "std",
          "var",
          "skew",
          "kurt",
      ]:
          s_rolling = rolling.agg(agg)
      elif agg == "nunique":
          s_rolling = rolling.agg(lambda x: len(np.unique(x.dropna())))
      elif agg == "nnz":
          s_rolling = rolling.agg(np.count_nonzero)
      elif agg == "quantile":
          if hasattr(agg_params["q"], "__iter__"):
              s_rolling = pd.concat(
                  [
                      rolling.quantile(q).rename("q{}".format(q))
                      for q in agg_params["q"]
                  ],
                  axis=1,
              )
          else:
              s_rolling = rolling.quantile(agg_params["q"])
      elif agg == "iqr":
          s_rolling = rolling.quantile(0.75) - rolling.quantile(0.25)
      elif agg == "idr":
          s_rolling = rolling.quantile(0.9) - rolling.quantile(0.1)
      elif agg == "hist":
          if isinstance(agg_params["bins"], int):
              _, bins = np.histogram(
                  s.dropna().values, bins=agg_params["bins"]
              )
          else:
              bins = agg_params["bins"]
          s_rolling = getRollingVector(
              rolling,
              lambda x: np.histogram(x, bins=bins)[0],
              (
                  [
                      "[{}, {}{}".format(
                          bins[i],
                          bins[i + 1],
                          ")" if i < len(bins) - 2 else "]",
                      )
                      for i in range(len(bins) - 1)
                  ]
              ),
          )
      elif callable(agg):
          try:
              s_rolling = rolling.agg(agg)
          except TypeError:
              if "names" in agg_params.keys():
                  s_rolling = getRollingVector(
                      rolling, agg, agg_params["names"]
                  )
              else:
                  raise RuntimeError(
                      "Names of vector output are not specified."
                  )
      else:
          raise ValueError(
              "Attribute agg must be one of {}".format(aggList)
          )
  
      if isinstance(s_rolling, pd.Series):
          s_rolling.name = s.name
  
      return s_rolling
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  import statsmodels
  from packaging.version import parse
  from statsmodels.tsa.seasonal import seasonal_decompose
  from statsmodels.tsa.stattools import acf
  from .._transformer_base import _NonTrainableUnivariateTransformer, _TrainableUnivariateTransformer
  from .._utils import PandasBugError
label_desc: Use image node_id 3 for calling the RollingAggregate obj's underlying member method code with example usage: obj._predict_core(s) and returns: s_rolling, s_rolling, int