code: def get_inferred_timestamps(
      df: pd.DataFrame,
      col: str,
      deltas: dict,
      tss,
      stat_analysis,
      time_format="",
  ) -> pd.DataFrame:
      horizon = tss.horizon
  
      last = np.vstack(df[f"order_{col}"].dropna().values)[:, -1]
  
      if tss.group_by:
          gby = [f"group_{g}" for g in tss.group_by]
          series_delta = (
              df[gby]
              .apply(
                  lambda x: deltas.get(
                      tuple(x.values.tolist()), deltas["__default"]
                  ),
                  axis=1,
              )
              .values
          )
          series_delta = series_delta.reshape(-1, 1)
      else:
          series_delta = np.full_like(
              df.values[:, 0:1], deltas["__default"]
          )
  
      last = np.repeat(np.expand_dims(last, axis=1), horizon, axis=1)
      lins = np.linspace(0, horizon - 1, num=horizon)
      series_delta = np.repeat(series_delta, horizon, axis=1)
      timestamps = last + series_delta * lins
  
      if time_format:
          if time_format.lower() == "infer":
              tformat = stat_analysis.ts_stats["order_format"]
          else:
              tformat = time_format
  
          if tformat:
  
              def _strfts(elt):
                  return datetime.utcfromtimestamp(elt).strftime(
                      tformat
                  )
  
              timestamps = np.vectorize(_strfts)(timestamps)
  
      # truncate to horizon
      timestamps = timestamps[:, :horizon]
  
      # preserves original input format if horizon == 1
      if tss.horizon == 1:
          timestamps = timestamps.squeeze()
  
      df[f"order_{col}"] = timestamps.tolist()
      return df[f"order_{col}"]
  
file_path: lightwood/lightwood/helpers/ts.py
imports: from typing import Tuple, Dict
  from datetime import datetime
  import numpy
  import pandas
label_desc: Use image node_id 3 for calling a global function with example usage: get_inferred_timestamps(df, col, deltas, tss, stat_analysis, time_format) and returns: df, datetime