class_docstr: Format a time series dataframe or list of dataframes into the a format that matches the structure learned by
      `from_pandas_dynamic`. This is done to allow for bayesian network probability fitting.
  
      Example of utilisation:
      >>> ddt = DynamicDataTransformer(p=p).fit(time_series, return_df=False)
      >>> X, Xlags = ddt.transform(time_series)
  
      >>> ddt = DynamicDataTransformer(p=p).fit(time_series, return_df=True)
      >>> df = ddt.transform(time_series)
docstr: Given a list of realisations of a time series, convert it to the format received by the dynotears algorithm.
  Each realisation on `realisations` is a realisation of the time series,
  where the time dimension is represented by the rows.
      - The higher the row, the higher the time index
      - The data is complete, meaning that the difference between two time stamps is equal one
  Args:
      realisations: a list of realisations of a time series
      p: the number of lagged columns to create
  
  Returns:
      X and Y as in the SVAR model and DYNOTEARS paper. I.e. X being representing X(m,t) and Y the concatenated
      differences [X(m,t-1) | X(m,t-2) | ... | X(m,t-p)]
docstr_tok: ["Given","a","list","of","realisations","of","a","time","series",",","convert","it","to","the","format","received","by","the","dynotears","algorithm",".","Each","realisation","on","`","realisations","`","is","a","realisation","of","the","time","series",",","where","the","time","dimension","is","represented","by","the","rows",".","-","The","higher","the","row",",","the","higher","the","time","index","-","The","data","is","complete",",","meaning","that","the","difference","between","two","time","stamps","is","equal","one","Args",":","realisations",":","a","list","of","realisations","of","a","time","series","p",":","the","number","of","lagged","columns","to","create","Returns",":","X","and","Y","as","in","the","SVAR","model","and","DYNOTEARS","paper",".","I.e",".","X","being","representing","X","(","m",",","t",")","and","Y","the","concatenated","differences","[","X","(","m",",","t-1",")","|","X","(","m",",","t-2",")","|","...","|","X","(","m",",","t-p",")","]"]
code: def _convert_realisations_into_dynotears_format(
      realisations: List[np.ndarray], p: int
  ) -> Tuple[np.ndarray, np.ndarray]:
      """
      Given a list of realisations of a time series, convert it to the format received by the dynotears algorithm.
      Each realisation on `realisations` is a realisation of the time series,
      where the time dimension is represented by the rows.
          - The higher the row, the higher the time index
          - The data is complete, meaning that the difference between two time stamps is equal one
      Args:
          realisations: a list of realisations of a time series
          p: the number of lagged columns to create
  
      Returns:
          X and Y as in the SVAR model and DYNOTEARS paper. I.e. X being representing X(m,t) and Y the concatenated
          differences [X(m,t-1) | X(m,t-2) | ... | X(m,t-p)]
      """
      X = np.concatenate(
          [realisation[p:] for realisation in realisations], axis=0
      )
      y_lag_list = [
          np.concatenate(
              [realisation[p - i - 1 : -i - 1] for i in range(p)],
              axis=1,
          )
          for realisation in realisations
      ]
      y_lag = np.concatenate(y_lag_list, axis=0)
  
      return X, y_lag
  
file_path: causalnex/causalnex/structure/transformers.py
imports: from copy import deepcopy
  from typing import List, Tuple, Union
  import numpy
  import pandas
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.exceptions import NotFittedError
label_desc: Use image node_id 7 for calling the DynamicDataTransformer obj's underlying member method code with example usage: obj._convert_realisations_into_dynotears_format(realisations, p) and returns: X,  y_lag