title: For every row in Pandas dataframe determine if a column value exists in another column
body: <p>I have a pandas data frame like this: </p>
  
  <pre><code>df = pd.DataFrame({'category' : ['A', 'B', 'C', 'A'], 'category_pred' : [['A'], ['B','D'], ['A','B','C'], ['D']]})
  print(df)
  
    category category_pred
  0        A           [A]
  1        B        [B, D]
  2        C     [A, B, C]
  3        A           [D]
  </code></pre>
  
  <p>I would like to have an output like this: </p>
  
  <pre><code>  category category_pred  count
  0        A           [A]      1
  1        B        [B, D]      1
  2        C     [A, B, C]      1
  3        A           [D]      0
  </code></pre>
  
  <p>That is, for every row, determine if the value in 'category' appears in 'category_pred'. Note that 'category_pred' can contain multiple values. </p>
  
  <p>I can do a for-loop like this one, but it is really slow.</p>
  
  <pre><code>for i in df.index:
      if df.category[i] in df.category_pred[i]:
          df['count'][i] = 1
  </code></pre>
  
  <p>I am looking for an efficient way to do this operation. Thanks! </p>