python生成词云图报错,用的是wordcloud库的generate函数。报错信息主要是“The input “text” is expected to be a natural text. If you pass a sorted”
经查找原因发现是定义wordcloud对象时写错了参数。
font_path写成了font_step
将参数改成font_path
就可以生成词云图了。
正确的语句也下:
w = wordcloud.WordCloud(width=1000,height=700,font_path="C:\Windows\Fonts\STLITI.TTF",background_color='white')