title: Count distinct values in Python list
body: <p>I have a datagram like below</p>
  
  <pre><code>lable                          unigrams                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  ham    [ive, searching, right, word, thank, breather, i, promise, wont] 
  spam   [free, entry, 2, wkly, comp, win, fa, cup, final, tkts, 21st, may]
  </code></pre>
  
  <p>I want to count the distinct/ unique ham unigrams and distinct spam unigrams. </p>
  
  <p>I can count the distinct values in a column using <code>df.unigrams.nunique()</code>.
  I can count the number of occurrences of a given unigram in ham using <code>unigramCount = unigramCorpus.loc["ham", "unigrams"].count('ive')</code> </p>
  
  <p>But how can I count the number of distinct values in a given list? Ex:  <code>["ham", "spam"]</code> </p>
  
  <p>Expected output:
  ham = 9
  spam = 12</p>