code: def _roll_out_time_series(
      timeshift,
      grouped_data,
      rolling_direction,
      max_timeshift,
      min_timeshift,
      column_sort,
      column_id,
  ):
      """
      Internal helper function for roll_time_series.
      This function has the task to extract the rolled forecast data frame of the number `timeshift`.
      This means it has shifted a virtual window if size `max_timeshift` (or infinite)
      `timeshift` times in the positive direction (for positive `rolling_direction`) or in negative direction
      (for negative `rolling_direction`).
      It starts counting from the first data point for each id (and kind) (or the last one for negative
      `rolling_direction`).
      The rolling happens for each `id` and `kind` separately.
      Extracted data smaller than `min_timeshift` + 1 are removed.
  
      Implementation note:
      Even though negative rolling direction means, we let the window shift in negative direction over the data,
      the counting of `timeshift` still happens from the first row onwards. Example:
  
          1   2   3   4
  
      If we do positive rolling, we extract the sub time series
  
        [ 1 ]               input parameter: timeshift=1, new id: ([id=]X,[timeshift=]1)
        [ 1   2 ]           input parameter: timeshift=2, new id: ([id=]X,[timeshift=]2)
        [ 1   2   3 ]       input parameter: timeshift=3, new id: ([id=]X,[timeshift=]3)
        [ 1   2   3   4 ]   input parameter: timeshift=4, new id: ([id=]X,[timeshift=]4)
  
      If we do negative rolling:
  
        [ 1   2   3   4 ]   input parameter: timeshift=1, new id: ([id=]X,[timeshift=]1)
            [ 2   3   4 ]   input parameter: timeshift=2, new id: ([id=]X,[timeshift=]2)
                [ 3   4 ]   input parameter: timeshift=3, new id: ([id=]X,[timeshift=]3)
                    [ 4 ]   input parameter: timeshift=4, new id: ([id=]X,[timeshift=]4)
  
      If you now reverse the order of the negative examples, it looks like shifting the
      window from the back (but it is implemented to start counting from the beginning).
  
      """
  
      def _f(x):
          if rolling_direction > 0:
              # For positive rolling, the right side of the window moves with `timeshift`
              shift_until = timeshift
              shift_from = max(shift_until - max_timeshift - 1, 0)
  
              df_temp = (
                  x.iloc[shift_from:shift_until]
                  if shift_until <= len(x)
                  else None
              )
          else:
              # For negative rolling, the left side of the window moves with `timeshift`
              shift_from = max(timeshift - 1, 0)
              shift_until = shift_from + max_timeshift + 1
  
              df_temp = x.iloc[shift_from:shift_until]
  
          if df_temp is None or len(df_temp) < min_timeshift + 1:
              return
  
          df_temp = df_temp.copy()
  
          # and set the shift correctly
          if column_sort and rolling_direction > 0:
              timeshift_value = df_temp[column_sort].iloc[-1]
          elif column_sort and rolling_direction < 0:
              timeshift_value = df_temp[column_sort].iloc[0]
          else:
              timeshift_value = timeshift - 1
          # and now create new ones ids out of the old ones
          df_temp["id"] = df_temp[column_id].apply(
              lambda row: (row, timeshift_value)
          )
  
          return df_temp
  
      return [grouped_data.apply(_f)]
  
file_path: tsfresh/tsfresh/utilities/dataframe_functions.py
imports: import warnings
  import numpy
  import pandas
  from tsfresh import defaults
  from tsfresh.utilities.distribution import DistributorBaseClass, MapDistributor, MultiprocessingDistributor
label_desc: Use image node_id 8 for calling a global function with example usage: _roll_out_time_series(timeshift, grouped_data, rolling_direction, max_timeshift, min_timeshift, column_sort, column_id) and returns: list, df_temp