code: def convert_timeseries_dataframe_to_supervised(
      df: pd.DataFrame, namevars, target, n_in=1, n_out=0, dropT=True
  ):
      """
      Transform a time series in dataframe format into a supervised learning dataset while
      keeping dataframe intact.
      Returns the transformed pandas DataFrame, the name of the target column and the names of the predictor columns
      Arguments:
          df: A timeseries dataframe that you want to convert to Supervised dataset.
          namevars: columns that you want to lag in the data frame. Other columns will be untouched.
          target: this is the target variable you intend to use in supervised learning
          n_in: Number of lag periods as input (X).
          n_out: Number of future periods (optional) as output for the taget variable (y).
          dropT: Boolean - whether or not to drop columns at time 't'.
          Returns:
          df: This is the transformed data frame with the time series columns laggged.
          Note that the original columns are dropped if you set the 'dropT' argument to True.
          If not, they are preserved.
      This Pandas DataFrame of lagged time series data is immediately available for supervised learning.
  
      rtype: pd.DataFrame, str, List[str]
      """
      target = copy.deepcopy(target)
      df = copy.deepcopy(df)
      int_vars = df.select_dtypes(include="integer").columns.tolist()
      # Notice that we will create a sequence of columns from name vars with suffix (t-n,... t-1), etc.
      drops = []
      int_changes = []
      for i in range(n_in, -1, -1):
          if i == 0:
              for var in namevars:
                  addname = var + "(t)"
                  df = df.rename(columns={var: addname})
                  drops.append(addname)
                  if var in int_vars:
                      int_changes.append(addname)
          else:
              for var in namevars:
                  addname = var + "(t-" + str(i) + ")"
                  df[addname] = df[var].shift(i)
                  if var in int_vars:
                      int_changes.append(addname)
      ## forecast sequence (t, t+1,... t+n)
      if n_out == 0:
          n_out = False
      for i in range(1, n_out):
          for var in namevars:
              addname = var + "(t+" + str(i) + ")"
              df[addname] = df[var].shift(-i)
      # 	drop rows with NaN values
      df = df.dropna()
  
      ### Make sure that whatever vars came in as integers return back as integers!
      if int_changes:
          ### only do this if there are some changes to implement ###
          df[int_changes] = df[int_changes].astype(np.int64)
  
      # 	put it all together
      for each_target in target:
          df = df.rename(columns={each_target + "(t)": each_target})
      if dropT:
          ### If dropT is true, all the "t" series of the target column (in case it is in the namevars)
          ### will be removed if you don't want the target to learn from its "t" values.
          ### Similarly, we will also drop all the "t" series of name_vars if you set dropT to Trueself.
          try:
              drops.remove(target)
          except:
              pass
          df.drop(drops, axis=1, inplace=True)
      preds = [x for x in list(df) if x not in target]
  
      return df, target, preds
  
imports: from typing import List
  import numpy
  import pandas
  import copy
  import pdb
  from sklearn.model_selection import TimeSeriesSplit
  import dask
  import dask.dataframe
  import datetime
  from datetime import datetime, date, time
label_desc: Use image node_id 8 for calling a global function with example usage: convert_timeseries_dataframe_to_supervised(df, namevars, target, n_in, n_out, dropT) and returns: df,  target,  preds