Generate word cloud from single-column Pandas dataframe
问题 I have a Pandas dataframe with one column: Crime type. The column contains 16 different "categories" of crime, which I would like to visualise as a word cloud, with words sized based on their frequency within the dataframe. I have attempted to do this with the following code: To bring the data in: fields = ['Crime type'] text2 = pd.read_csv('allCrime.csv', usecols=fields) To generate the word cloud: wordcloud2 = WordCloud().generate(text2) # Generate plot plt.imshow(wordcloud2) plt.axis("off"