code: def __init__(
      self,
      df,
      column_id,
      column_kind=None,
      column_value=None,
      column_sort=None,
  ):
      if column_id is None:
          raise ValueError("column_id must be set")
  
      if column_id not in df.columns:
          raise ValueError(f"Column not found: {column_id}")
  
      # Get all columns, which are not id, kind or sort
      possible_value_columns = _get_value_columns(
          df, column_id, column_sort, column_kind
      )
  
      # The user has already a kind column. That means we just need to group by id (and additionally by id)
      if column_kind is not None:
          if column_kind not in df.columns:
              raise ValueError(f"Column not found: {column_kind}")
  
          self.df = df.groupby([column_id, column_kind])
  
          # We assume the last remaining column is the value - but there needs to be one!
          if column_value is None:
              if len(possible_value_columns) != 1:
                  raise ValueError(
                      "Could not guess the value column! Please hand it to the function as an argument."
                  )
              column_value = possible_value_columns[0]
      else:
          # Ok, the user has no kind, so it is in Wide format.
          # That means we have do melt before we can group.
          # TODO: here is some room for optimization!
          # we could choose the same way as for the Wide and LongTsAdapter
  
          # We first choose a name for our future kind column
          column_kind = "kind"
  
          # if the user has specified a value column, use it
          # if not, just go with every remaining columns
          if column_value is not None:
              value_vars = [column_value]
          else:
              value_vars = possible_value_columns
              column_value = "value"
  
          # Make sure we are not reusing a column that already exists
          while column_value in df.columns:
              column_value += "_"
  
          _check_colname(*value_vars)
  
          id_vars = (
              [column_id, column_sort] if column_sort else [column_id]
          )
  
          # Now melt and group
          df_melted = df.melt(
              id_vars=id_vars,
              value_vars=value_vars,
              var_name=column_kind,
              value_name=column_value,
          )
  
          self.df = df_melted.groupby([column_id, column_kind])
  
      self.column_id = column_id
      self.column_kind = column_kind
      self.column_value = column_value
      self.column_sort = column_sort
  
imports: import itertools
  from collections import defaultdict, namedtuple
  from typing import Iterable, Sized
  import pandas
label_desc: Use image node_id 1 to create a new DaskTsAdapter object from inherited base classes: TsData with example: obj = DaskTsAdapter(df, column_id, column_kind, column_value, column_sort)