code: def add_group(data: pd.DataFrame) -> pd.DataFrame:
      """
      Add group to the dataframe
  
      The group depends on the interaction of the discrete
      aesthetic columns in the dataframe.
      """
      if len(data) == 0:
          return data
  
      if "group" not in data:
          ignore = data.columns.difference(list(SCALED_AESTHETICS))
          disc = discrete_columns(data, ignore=ignore)
          if disc:
              data["group"] = ninteraction(data[disc], drop=True)
          else:
              data["group"] = NO_GROUP
      else:
          data["group"] = ninteraction(data[["group"]], drop=True)
  
      return data
  
imports: from __future__ import annotations
  import typing
  from copy import copy, deepcopy
  from typing import Iterable, List, cast, overload
  import pandas
  from ._utils import array_kind, check_required_aesthetics, ninteraction
  from .exceptions import PlotnineError
  from .mapping.aes import NO_GROUP, SCALED_AESTHETICS, aes
  from .mapping.evaluation import evaluate, stage
label_desc: Use image node_id 1 for calling a global function with example usage: add_group(data) and returns: data, data