code: def test_one_hot_encode_equivalent_to_get_dummies():
      # Use a mix of already-numeric and requires encoding cols:
      data = {
          "C": ["X", "Y", "Z", "X", "Y", "Z"],
          "N": [1, 2, 3, 4, 5, 6],
      }
      df = pd.DataFrame(data)
  
      # NB There may be small differences in type but since all values will be used in models as float,
      # comparison is done as this type.
      df_dummies = pd.get_dummies(df, drop_first=True)
      df_dummies = df_dummies.astype(float)
  
      df_sklearn, _ = one_hot_encode(df, drop_first=True)
      df_sklearn = df_sklearn.astype(float)
  
      # Check same rows
      len1 = len(df_dummies)
      len2 = len(df_sklearn)
      assert len1 == len2
  
      # Check same number of cols
      len1 = len(df_dummies.columns)
      len2 = len(df_sklearn.columns)
      assert len1 == len2
  
      # Check values
      # Calculate the sum of absolute differences between the two DataFrames
      # - should be zero (excl. floating point error)
      sum_abs_diff = (df_dummies - df_sklearn).abs().sum().sum()
      assert sum_abs_diff == approx(0.0)
  
imports: import networkx
  import numpy
  import pandas
  from _pytest.python_api import approx
  from dowhy.utils.encoding import one_hot_encode
label_desc: Use image node_id 1 for calling a global function with example usage: test_one_hot_encode_equivalent_to_get_dummies() without return types