code: def test_LabelEncoder(generate_categorical_data):
      df = generate_categorical_data()
      cat_cols = [
          col for col in df.columns if df[col].dtype == "object"
      ]
      n_category = 0
      for col in cat_cols:
          n_category += df[col].nunique()
  
      lbe = LabelEncoder(min_obs=2)
      X_cat = lbe.fit_transform(df[cat_cols])
      n_label = 0
      for col in cat_cols:
          n_label += X_cat[col].nunique()
  
      assert df.shape[0] == X_cat.shape[0] and n_label < n_category
  
imports: import pandas
  import pytest
  from causalml.features import OneHotEncoder, LabelEncoder, load_data
label_desc: Use image node_id 3 for calling a global function with example usage: test_LabelEncoder(generate_categorical_data) without return types