You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
I am using Jupyter notebook to create a word cloud, but I'm encountering some issues that I can't resolve. I've tried various methods online, but I'm still stuck.。
C:\anaconda\lib\site-packages\wordcloud\wordcloud.py in generate_from_frequencies(self, frequencies, max_font_size)
401 frequencies = sorted(frequencies.items(), key=itemgetter(1), reverse=True)
402 if len(frequencies) <= 0:
--> 403 raise ValueError("We need at least 1 word to plot a word cloud, "
404 "got %d." % len(frequencies))
405 frequencies = frequencies[:self.max_words]
ValueError: We need at least 1 word to plot a word cloud, got 0.`
The text was updated successfully, but these errors were encountered:
Hey,
I am using Jupyter notebook to create a word cloud, but I'm encountering some issues that I can't resolve. I've tried various methods online, but I'm still stuck.。
`ValueError Traceback (most recent call last)
in
31 index_positive = data['scores'] >= 30.0
32
---> 33 my_word_cloud(data['content'][index_negative],stoplist,'aixin.jpg') # 差评词云
34 my_word_cloud(data['content'][index_positive],stoplist,'aixin.jpg') # 好评词云
in my_word_cloud(data, stoplist, img)
16 )
17 # 词云绘制
---> 18 wc.fit_words(wordFre)
19 plt.imshow(wc) # 词云
20 plt.axis('off') # 关闭坐标
C:\anaconda\lib\site-packages\wordcloud\wordcloud.py in fit_words(self, frequencies)
380 self
381 """
--> 382 return self.generate_from_frequencies(frequencies)
383
384 def generate_from_frequencies(self, frequencies, max_font_size=None): # noqa: C901
C:\anaconda\lib\site-packages\wordcloud\wordcloud.py in generate_from_frequencies(self, frequencies, max_font_size)
401 frequencies = sorted(frequencies.items(), key=itemgetter(1), reverse=True)
402 if len(frequencies) <= 0:
--> 403 raise ValueError("We need at least 1 word to plot a word cloud, "
404 "got %d." % len(frequencies))
405 frequencies = frequencies[:self.max_words]
ValueError: We need at least 1 word to plot a word cloud, got 0.`
The text was updated successfully, but these errors were encountered: