title: Compare value of Dataframe column with list value
body: <p>I have a spark dataframe columns 'id' and 'articles' and a list of values 'a_list' as below.</p>
  
  <pre><code>df = spark.createDataFrame([(1, 4), (2, 3), (5, 6)], ("id", "articles"))
  
  a_list = [1, 4, 6]
  </code></pre>
  
  <p>I am trying to compare list value with value of dataframe column "articles" and if match found updating column 'E' to 1 else 0</p>
  
  <p>I am using "isin" in my code below</p>
  
  <pre><code>df['E'] = df.articles.isin(a_list).astype(int)
  </code></pre>
  
  <p>Getting </p>
  
  <blockquote>
    <p>TypeError: unexpected type: <code>&lt;type 'type'&gt;</code></p>
  </blockquote>
  
  <p>What am I missing here ?</p>