docstr: test that if the input is a pd.Categorical the output is the same as for string columns
  :return:
docstr_tok: ["test","that","if","the","input","is","a","pd.Categorical","the","output","is","the","same","as","for","string","columns",":","return",":"]
code: def test_leave_one_out_categorical(self):
      """
      test that if the input is a pd.Categorical the output is the same as for string columns
      :return:
      """
      df = pd.DataFrame(
          {
              "color_str": ["a", "a", "a", "b", "b", "b"],
              "color_num_cat": pd.Categorical(
                  [1.0, 1.0, 1.0, 2.0, 2.0, 2.0]
              ),
              "color_str_cat": pd.Categorical(
                  ["a", "a", "a", "b", "b", "b"]
              ),
              "outcome": [1, 0, 0, 1, 0, 1],
          }
      )
  
      X = df.drop("outcome", axis=1)
      y = df["outcome"]
  
      ce_leave = encoders.LeaveOneOutEncoder()
      obtained = ce_leave.fit_transform(X, y)
  
      for col in obtained.columns:
          self.assertEqual(
              [0.0, 0.5, 0.5, 0.5, 1.0, 0.5], list(obtained[col])
          )
  
file_path: category_encoders/tests/test_leave_one_out.py
imports: import pandas
  from unittest import TestCase
  import tests.helpers
  import numpy
  import category_encoders
label_desc: Use image node_id 9 for calling the TestLeaveOneOutEncoder obj's underlying member method code with example usage: obj.test_leave_one_out_categorical() without return types