title: Text analysis: finding the most common word in a column using python
body: <p>I have created a dataframe with just a column with the subject line.</p>
  
  <pre><code>df = activities.filter(['Subject'],axis=1)
  df.shape
  </code></pre>
  
  <p>This returned this dataframe:</p>
  
  <pre><code>    Subject
  0   Call Out: Quadria Capital - May Lo, VP
  1   Call Out: Revelstoke - Anthony Hayes (Sr Assoc...
  2   Columbia Partners: WW Worked (Not Sure Will Ev...
  3   Meeting, Sophie, CFO, CDC Investment
  4   Prospecting
  </code></pre>
  
  <p>I then tried to analyse the text with this code:</p>
  
  <pre><code>import nltk
  top_N = 50
  txt = df.Subject.str.lower().str.replace(r'\|', ' ')
  words = nltk.tokenize.word_tokenize(txt)
  word_dist = nltk.FreqDist(words)
  
  stopwords = nltk.corpus.stopwords.words('english')
  words_except_stop_dist = nltk.FreqDist(w for w in words if w not in stopwords) 
  
  rslt = pd.DataFrame(word_dist.most_common(top_N), columns=['Word', 'Frequency'])
  print(rslt)
  </code></pre>
  
  <p>The error message I get is: 'Series' object has no attribute 'Subject'</p>