code: def test_transform_with_index():
      df = cudf.DataFrame(
          {"a": [1, 1, 2, 3], "b": [True, False, False, True]},
          index=[9, 4, 5, 3],
      )
  
      t_enc = TargetEncoder()
  
      t_enc.fit(df.a, y=df.b)
      train_encoded = t_enc.transform(df.a)
      ans = cp.asarray([0, 1, 0.5, 0.5])
      assert array_equal(train_encoded, ans)
  
      train_encoded = t_enc.transform(df[["a"]])
      assert array_equal(train_encoded, ans)
  
file_path: cuml/python/cuml/tests/test_target_encoder.py
imports: import pytest
  from cuml.testing.utils import array_equal
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.preprocessing.TargetEncoder import TargetEncoder
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 13 for calling a global function with example usage: test_transform_with_index() without return types