code: def train_data_idx(train_data) -> pd.DataFrame:
      """
      train_data in integer index form. This maps each column into values from 0..n
      """
  
      df = train_data.copy(deep=True)  # type: pd.DataFrame
  
      df["a"] = df["a"].map({"a": 0, "b": 1, "c": 2, "d": 3})
      df["b"] = df["b"].map({"x": 0, "y": 1, "z": 2})
      df["c"] = df["c"].apply(
          lambda c: 0
          if c < 20
          else 1
          if c < 40
          else 2
          if c < 60
          else 3
          if c < 80
          else 4
      )
      df["d"] = df["d"].map({True: 1, False: 0})
      df["e"] = df["e"].map({True: 1, False: 0})
      return df
  
imports: import itertools
  from typing import Dict
  import numpy
  import pandas
  import pytest
  from pgmpy.models import BayesianNetwork
  from sklearn.datasets import load_iris
  from causalnex.discretiser import Discretiser
  from causalnex.network import BayesianNetwork
  from causalnex.structure import StructureModel
  from causalnex.structure.notears import from_pandas
label_desc: Use image node_id 5 for calling a global function with example usage: train_data_idx(train_data) and returns: df