docstr: Finds last observation for every series in a pre-sorted `df` given a `gby` list of columns to group by.
docstr_tok: ["Finds","last","observation","for","every","series","in","a","pre-sorted","`","df","`","given","a","`","gby","`","list","of","columns","to","group","by","."]
code: def _set_boundary(df: pd.DataFrame, gby: list) -> Dict[str, object]:
      """
      Finds last observation for every series in a pre-sorted `df` given a `gby` list of columns to group by.
      """
      if not gby:
          group_boundaries = {"__default": df.iloc[-1]["ds"]}
      else:
          # could use groupby().transform('max'), but we leverage pre-sorting instead
          grouped_df = df.groupby(by="unique_id", as_index=False).last()
          group_boundaries = (
              grouped_df[["unique_id", "ds"]]
              .set_index("unique_id")
              .to_dict()["ds"]
          )
  
      return group_boundaries
  
file_path: lightwood/lightwood/mixer/nhits.py
imports: from typing import Dict, Union, Optional
  from copy import deepcopy
  import numpy
  import pandas
  from neuralforecast import NeuralForecast
  from neuralforecast.models.nhits import NHITS
  from neuralforecast.models.nbeats import NBEATS
  from neuralforecast.losses.pytorch import MQLoss
  from lightwood.helpers.log import log
  from lightwood.mixer.base import BaseMixer
  from lightwood.api.types import PredictionArguments
  from lightwood.data.encoded_ds import EncodedDs, ConcatedEncodedDs
label_desc: Use image node_id 6 for calling the NHitsMixer obj's underlying member method code with example usage: obj._set_boundary(df, gby) and returns: group_boundaries