code: def split_range_into_groups(
      n, group_size, which_group_complete="last"
  ):
      """Partitions `n` elements into adjacent groups,
          each with `group_size` elements
          Group number starts from 0 and increments upward
          Can be used to generate groups for sliding window aggregation.
      :param n: int
          number of elemnts to split into groups
      :param group_size: int
          number of elements per group
      :param which_group_complete: str
          If n % group_size > 0, one group will have fewer than `group_size` elements
          if "first", the first group is full if possible, and last group may be incomplete
          if "last", (default) the last group is full if possible,
          and first group may be incomplete
      :return: np.array of length n
          values correspond to the element's group number
  
      Examples:
      >>> split_range_into_groups(10, 1, "last")
      array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
      >>> split_range_into_groups(10, 2, "last")
      array([0., 0., 1., 1., 2., 2., 3., 3., 4., 4.])
      >>> split_range_into_groups(10, 3, "last")
      array([0., 1., 1., 1., 2., 2., 2., 3., 3., 3.])
      >>> split_range_into_groups(10, 4, "last")
      array([0., 0., 1., 1., 1., 1., 2., 2., 2., 2.])
      >>> split_range_into_groups(10, 4, "first")
      array([0., 0., 0., 0., 1., 1., 1., 1., 2., 2.])
      >>> split_range_into_groups(10, 5, "last")
      array([0., 0., 0., 0., 0., 1., 1., 1., 1., 1.])
      >>> split_range_into_groups(10, 6, "last")
      array([0., 0., 0., 0., 1., 1., 1., 1., 1., 1.])
      >>> split_range_into_groups(10, 10, "last")
      array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
      >>> split_range_into_groups(10, 12, "last")
      array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
      """
      if which_group_complete.lower() == "first":
          offset = 0
      else:
          offset = group_size - n % group_size
          offset = (
              offset % group_size
          )  # sets offset to 0 if n % group_size == 0
      return np.floor(np.arange(offset, n + offset) / group_size)
  
imports: import warnings
  import numpy
  import pandas
  import plotly.graph_objects
  from plotly.colors import DEFAULT_PLOTLY_COLORS
  from plotly.subplots import make_subplots
  from greykite.common import constants
  from greykite.common.features.timeseries_features import build_time_features_df
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
  from greykite.common.python_utils import update_dictionary
  from greykite.common.viz.colors_utils import get_color_palette
  from greykite.common.viz.colors_utils import get_distinct_colors
label_desc: Use image node_id 5 for calling a global function with example usage: split_range_into_groups(n, group_size, which_group_complete) and returns: np