title: Separate Spam and Ham for WordCloud Visualization
body: <p>I am performing spam detection and want to visualize spam and ham keywords separately in Wordcloud. Here's my .csv file.</p>
  
  <pre><code>data = pd.read_csv("spam.csv",encoding='latin-1')
  data = data.rename(columns = {"v1":"label", "v2":"message"})
  data = data.replace({"spam":"1","ham":"0"})
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qR0yN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qR0yN.jpg" alt="data.head()"></a></p>
  
  <p>Here's my code for WordCloud. I need help with spam_words. I cannot generate the right graph. </p>
  
  <pre><code>import matplotlib.pyplot as plt
  from wordcloud import WordCloud 
  
  spam_words = ' '.join(list(data[data['label'] == 1 ]['message']))
  spam_wc = WordCloud(width = 512, height = 512).generate(spam_words)
  
  plt.figure(figsize = (10,8), facecolor = 'k')
  plt.imshow(spam_wc)
  plt.axis('off')
  plt.tight_layout(pad = 0)
  plt.show()
  </code></pre>