From faf56a3ea83a20083e32c9ae2a07a46237dea1f0 Mon Sep 17 00:00:00 2001 From: p34h2feab <2067143228@qq.com> Date: Wed, 18 Sep 2024 22:48:53 +0800 Subject: [PATCH] ADD file via upload --- picture.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 picture.py diff --git a/picture.py b/picture.py new file mode 100644 index 0000000..d787ebd --- /dev/null +++ b/picture.py @@ -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()