Word Cloud

ワインのレビューを使って、word cloudを作成する。 レビュー全体のword cloudを作る import pandas as pd from wordcloud import WordCloud import matplotlib.pyplot as plt % matplotlib inline df = pd.read_csv("data/winemag-data-130k-v2.csv", index_col=0) # 1個目のレビューのword cloud text = df.description wordcloud = WordCloud.generate(text) plt.imshow(wordcloud, interpolation='bilinear') plt.axis("off") plt.show() Fraceのレビューを作る frace_description = df[df.country == "France"].description text = ' '.join(frace_description) wordcloud = WordCloud().generate(text) # Display the generated image: plt.imshow(wordcloud, interpolation='bilinear') plt.axis("off") plt.show() 国別のword cloudを作って、レビューも違ってくることがわかる。