title: How to encode column of list for catboost?
body: <p>I have a dataset where some columns contain lists:</p>
  <pre><code>import pandas as pd
  
  df = pd.DataFrame(
      {'var1': [1, 2, 3, 1, 2, 3],
       'var2': [1, 1, 1, 2, 2, 2],
       'var3': [[&quot;A&quot;, &quot;B&quot;, &quot;C&quot;], [&quot;A&quot;, &quot;C&quot;], None, [&quot;A&quot;, &quot;B&quot;], [&quot;C&quot;, &quot;A&quot;], [&quot;D&quot;, &quot;A&quot;]]
      }
  )
  
      var1    var2    var3
  0      1       1    [A, B, C]
  1      2       1    [A, C]
  2      3       1    None
  3      1       2    [A, B]
  4      2       2    [C, A]
  5      3       2    [D, A]
  </code></pre>
  <p>As the values within the lists of <code>var3</code> can be shuffled and we can't assume any specific order the only way I can think of to prepare the columns for modelling is one-hot encoding. It could be done quite easily:</p>
  <pre><code>df[&quot;var3&quot;] = df[&quot;var3&quot;].apply(lambda x: [str(x)] if type(x) is not list else x)
  
  mlb = MultiLabelBinarizer()
  mlb.fit_transform(df[&quot;var3&quot;])
  </code></pre>
  <p>resulting in:</p>
  <pre><code>array([[1, 1, 1, 0, 0],
     [1, 0, 1, 0, 0],
     [0, 0, 0, 0, 1],
     [1, 1, 0, 0, 0],
     [1, 0, 1, 0, 0],
     [1, 0, 0, 1, 0]])
  </code></pre>
  <p>However, quoting catboost documentation:</p>
  <blockquote>
  <p>Attention. Do not use one-hot encoding during preprocessing. This
  affects both the training speed and the resulting quality.</p>
  </blockquote>
  <p>Therefore, I'd like to ask if there's any other way I could encode this column for modelling with <code>catboost</code>?</p>