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: Initialise Transformer
  Args:
      p: Number of past interactions we allow the model to create. The state of a variable at time `t` is
          affected by the variables at the time stamp + the variables at `t-1`, `t-2`,... `t-p`.
docstr_tok: ["Initialise","Transformer","Args",":","p",":","Number","of","past","interactions","we","allow","the","model","to","create",".","The","state","of","a","variable","at","time","`","t","`","is","affected","by","the","variables","at","the","time","stamp","+","the","variables","at","`","t-1","`",",","`","t-2","`",",","...","`","t-p","`","."]
code: def __init__(self, p: int):
      """
      Initialise Transformer
      Args:
          p: Number of past interactions we allow the model to create. The state of a variable at time `t` is
              affected by the variables at the time stamp + the variables at `t-1`, `t-2`,... `t-p`.
      """
      self.p = p
      self.columns = None
      self.return_df = None
  
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 1 to create a new DynamicDataTransformer object from inherited base classes: BaseEstimator, TransformerMixin with example: obj = DynamicDataTransformer(p)