code: def get_results_from_nixtla_df(nixtla_df, model_args):
      """Transform dataframes generated by StatsForecast back to their original format.
  
      This will return the dataframe to the original format supplied by the MindsDB query.
      """
      return_df = nixtla_df.reset_index(
          drop=True if "unique_id" in nixtla_df.columns else False
      )
      if len(model_args["group_by"]) > 0:
          if len(model_args["group_by"]) > 1:
              for i, group in enumerate(model_args["group_by"]):
                  return_df[group] = return_df["unique_id"].apply(
                      lambda x: x.split("/")[i]
                  )
          else:
              group_by_col = model_args["group_by"][0]
              return_df[group_by_col] = return_df["unique_id"]
  
      return return_df.drop(["unique_id"], axis=1).rename(
          {"ds": model_args["order_by"]}, axis=1
      )
  
file_path: mindsdb/mindsdb/integrations/utilities/time_series_utils.py
imports: import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from sklearn.metrics import r2_score
  from mindsdb.utilities import log
label_desc: Use image node_id 2 for calling a global function with example usage: get_results_from_nixtla_df(nixtla_df, model_args) and returns: return_df