code: def test_labelencoder_transform(length, cardinality, client):
      """Try fitting and then encoding a small subset of the df"""
      tmp = cudf.Series(np.random.choice(cardinality, (length,)))
      df = dask_cudf.from_cudf(tmp, npartitions=len(client.has_what()))
      le = LabelEncoder().fit(df)
      assert le._fitted
  
      encoded = le.transform(df)
  
      df_arr = df.compute().to_numpy()
      df_arr = _arr_to_similarity_mat(df_arr)
      encoder_arr = cp.asnumpy(encoded.compute().to_numpy())
      encoded_arr = _arr_to_similarity_mat(encoder_arr)
      assert (
          (encoded_arr == encoded_arr.T) == (df_arr == df_arr.T)
      ).all()
  
file_path: cuml/python/cuml/tests/dask/test_dask_label_encoder.py
imports: from cuml.common.exceptions import NotFittedError
  import pytest
  from cuml.internals.safe_imports import cpu_only_import
  import cuml
  from cuml.dask.preprocessing.LabelEncoder import LabelEncoder
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 3 for calling a global function with example usage: test_labelencoder_transform(length, cardinality, client) without return types