parent
378aa9addc
commit
faf56a3ea8
@ -0,0 +1,16 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from wordcloud import WordCloud
|
||||||
|
import jieba
|
||||||
|
|
||||||
|
# 读取弹幕数据
|
||||||
|
df = pd.read_excel('danmakus.xlsx')
|
||||||
|
|
||||||
|
# 生成词云
|
||||||
|
text = ' '.join(jieba.cut(' '.join(df['danmaku'])))
|
||||||
|
wordcloud = WordCloud(font_path='msyh.ttc', width=800, height=400).generate(text)
|
||||||
|
|
||||||
|
# 显示词云
|
||||||
|
plt.figure(figsize=(10, 5))
|
||||||
|
plt.imshow(wordcloud, interpolation='bilinear')
|
||||||
|
plt.axis('off')
|
||||||
|
plt.show()
|
Loading…
Reference in new issue