code: def generate_dataframe_dynamic(  # pylint: disable=R0914
      g: StructureModel,
      n_samples: int = 1000,
      burn_in: int = 100,
      sem_type: str = "linear-gauss",
      noise_scale: float = 1.0,
      drift: np.ndarray = None,
  ) -> pd.DataFrame:
      """Simulate samples from dynamic SEM with specified type of noise.
      Args:
          g: Dynamic DAG
          n_samples: number of samples
          burn_in: number of samples to discard
          sem_type: {linear-gauss,linear-exp,linear-gumbel}
          noise_scale: scale parameter of noise distribution in linear SEM
          drift: array of drift terms for each node, if None then the drift is 0
      Returns:
          X: [n,d] sample matrix, row t is X_t
          Y: [n,d*p] sample matrix, row t is [X_{t-1}, ..., X_{t-p}]
      Raises:
          ValueError: if sem_type isn't linear-gauss/linear_exp/linear-gumbel
      """
      s_types = ("linear-gauss", "linear-exp", "linear-gumbel")
      if sem_type not in s_types:
          raise ValueError(
              f"unknown sem type {sem_type}. Available types are: {s_types}"
          )
      intra_nodes = sorted(el for el in g.nodes if "_lag0" in el)
      inter_nodes = sorted(el for el in g.nodes if "_lag0" not in el)
      w_mat = nx.to_numpy_array(g, nodelist=intra_nodes)
      a_mat = nx.to_numpy_array(g, nodelist=intra_nodes + inter_nodes)[
          len(intra_nodes) :, : len(intra_nodes)
      ]
      g_intra = nx.DiGraph(w_mat)
      g_inter = nx.bipartite.from_biadjacency_matrix(
          csr_matrix(a_mat), create_using=nx.DiGraph
      )
      d = w_mat.shape[0]
      p = a_mat.shape[0] // d
      total_length = n_samples + burn_in
      X = np.zeros([total_length, d])
      Xlags = np.zeros([total_length, p * d])
      ordered_vertices = list(nx.topological_sort(g_intra))
      if drift is None:
          drift = np.zeros(d)
      for t in range(total_length):
          for j in ordered_vertices:
              parents = list(g_intra.predecessors(j))
              parents_prev = list(g_inter.predecessors(j + p * d))
              X[t, j] = (
                  drift[j]
                  + X[t, parents].dot(w_mat[parents, j])
                  + Xlags[t, parents_prev].dot(a_mat[parents_prev, j])
              )
              if sem_type == "linear-gauss":
                  X[t, j] = X[t, j] + np.random.normal(
                      scale=noise_scale
                  )
              elif sem_type == "linear-exp":
                  X[t, j] = X[t, j] + np.random.exponential(
                      scale=noise_scale
                  )
              elif sem_type == "linear-gumbel":
                  X[t, j] = X[t, j] + np.random.gumbel(
                      scale=noise_scale
                  )
  
          if (t + 1) < total_length:
              Xlags[t + 1, :] = np.concatenate([X[t, :], Xlags[t, :]])[
                  : d * p
              ]
      return pd.concat(
          [
              pd.DataFrame(X[-n_samples:], columns=intra_nodes),
              pd.DataFrame(Xlags[-n_samples:], columns=inter_nodes),
          ],
          axis=1,
      )
  
file_path: causalnex/causalnex/structure/data_generators/wrappers.py
imports: import warnings
  from typing import List, Optional, Tuple
  import networkx
  import numpy
  import pandas
  from scipy.sparse import csr_matrix
  from sklearn.gaussian_process.kernels import Kernel
  from causalnex.structure.data_generators import generate_structure, nonlinear_sem_generator, sem_generator
  from causalnex.structure.structuremodel import StructureModel
label_desc: Use image node_id 9 for calling a global function with example usage: generate_dataframe_dynamic(g, n_samples, burn_in, sem_type, noise_scale, drift) and returns: pd