title: TypeError: Image data cannot be converted to float keeps persisting as an error in word cloud building program
body: <p>I am trying to build a word cloud image by passing the program a .txt file then iterating through said txt file, processing out any punctuations and uninteresting filler words, then passing the processed dictionary to an external word cloud module.
  I have already set the file_contents into a word list and split them. Then iterated through the list to replace any punctuations with empty strings and then set the dictionary to iterate through the list and store the words in said dictionary. Once the results are stored in the dictionary they're checked for a list of filler words and if there are matches they are replaced with an empty string, then the dict values are returned. I've tried everything and still can't find what's wrong on my own.</p>
  <pre><code>def calculate_frequencies(file_contents):
  # Here is a list of punctuations and uninteresting words you can use to process your text
  punctuations = '''!()-[]{};:'&quot;\,&lt;&gt;./?@#$%^&amp;*_~'''
  uninteresting_words = [&quot;the&quot;, &quot;a&quot;, &quot;to&quot;, &quot;if&quot;, &quot;is&quot;, &quot;it&quot;, &quot;of&quot;, &quot;and&quot;, &quot;or&quot;, &quot;an&quot;, &quot;as&quot;, &quot;i&quot;, &quot;me&quot;, &quot;my&quot;, \
  &quot;we&quot;, &quot;our&quot;, &quot;ours&quot;, &quot;you&quot;, &quot;your&quot;, &quot;yours&quot;, &quot;he&quot;, &quot;she&quot;, &quot;him&quot;, &quot;his&quot;, &quot;her&quot;, &quot;hers&quot;, &quot;its&quot;, &quot;they&quot;, &quot;them&quot;, \
  &quot;their&quot;, &quot;what&quot;, &quot;which&quot;, &quot;who&quot;, &quot;whom&quot;, &quot;this&quot;, &quot;that&quot;, &quot;am&quot;, &quot;are&quot;, &quot;was&quot;, &quot;were&quot;, &quot;be&quot;, &quot;been&quot;, &quot;being&quot;, \
  &quot;have&quot;, &quot;has&quot;, &quot;had&quot;, &quot;do&quot;, &quot;does&quot;, &quot;did&quot;, &quot;but&quot;, &quot;at&quot;, &quot;by&quot;, &quot;with&quot;, &quot;from&quot;, &quot;here&quot;, &quot;when&quot;, &quot;where&quot;, &quot;how&quot;, \
  &quot;all&quot;, &quot;any&quot;, &quot;both&quot;, &quot;each&quot;, &quot;few&quot;, &quot;more&quot;, &quot;some&quot;, &quot;such&quot;, &quot;no&quot;, &quot;nor&quot;, &quot;too&quot;, &quot;very&quot;, &quot;can&quot;, &quot;will&quot;, &quot;just&quot;]
  
  # LEARNER CODE START HERE
  words = [file_contents.split()]
  frequencies = {}
  for word in words:
      if punctuations in words:
          words.replace(punctuations, &quot;&quot;)
          frequencies = {word +1} 
          if uninteresting_words in frequencies:
              frequencies.replace(uninteresting_words, &quot;&quot;)
          return frequencies
      return words
  
  #wordcloud
  cloud = wordcloud.WordCloud()
  cloud.generate_from_frequencies(frequencies)
  return cloud.to_array()
  </code></pre>
  <p>Any tips and pointers will help, thanks</p>