title: Pandas Dataframe: Count unique words in a column and return count in another column
body: <p>I have a dataframe which has the following columns</p>
  
  <ol>
  <li>df['Album'] (contains album names of artistX )</li>
  <li>df['Tracks'] (contains Tracks in the albums of artistX)</li>
  <li>df['Lyrics'] (contains Lyrics of the tracks )</li>
  </ol>
  
  <p>I am trying to count the number of words in df['Lyrics'] and return a new column called df['wordcount'] as well count the number of unique words in df['Lyrics'] and return a new column called df['uniquewordcount'].</p>
  
  <p>I have been able to get df['wordcount'] by counting every string in df['lyrics'] minus white space.</p>
  
  <p><code>totalscore = df.Lyrics.str.count('[^\s]') #count every word in a track
  df['wordcount'] = totalscore
  df</code></p>
  
  <p>I have been able to count unique words in df['Lyrics']</p>
  
  <pre><code>import collections
  from collections import Counter
  
  results = Counter()
  count_unique = df.Lyrics.str.lower().str.split().apply(results.update)
  unique_counts = sum((results).values())
  df['uniquewordcount'] = unique_counts
  </code></pre>
  
  <p>And that gives me the count of all the unique words in df['Lyrics'], which is what the code is meant to do, but I want the unique words in the lyrics of each track, My python isn't great currently so the solution might be obvious to everyone but not me. I would love someone to point me in the right direction on how to get the count of the unique words for each track.</p>
  
  <p>expected output:</p>
  
  <pre><code>Album    Tracks    Lyrics                      wordcount  uniquewordcount
   A         Ball   Ball is life and Ball is key       7           5
             Pass   Pass me the hookah Pass me the     7           4
  </code></pre>
  
  <p>what I got:</p>
  
  <pre><code>Album    Tracks    Lyrics                    wordcount  uniquewordcount
    A     Ball   Ball is life and Ball is key       7           9
          Pass   Pass me the hookah Pass me the     7           9
  </code></pre>