添加练习内容(词云)

This commit is contained in:
965 2023-05-23 22:14:15 +08:00
parent c053919887
commit 9f9301876c
3 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
A1 = np.loadtxt('ex3.csv', dtype=str, delimiter=',')
A1 = np.loadtxt('./resources/ex3.csv', dtype=str, delimiter=',')
month = np.array(A1[:, 0][1:13])
n1_data = [eval(x) for x in A1[:, 1][1:13]]
n2_data = [eval(x) for x in A1[:, 2][1:13]]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 KiB

After

Width:  |  Height:  |  Size: 297 KiB

View File

@ -4,10 +4,10 @@ from PIL import Image
import numpy as np
raw_data = open("111.txt", encoding="gbk").read()
raw_data = open("./resources/111.txt", encoding="gbk").read()
ls = jieba.lcut(raw_data)
text = ' '.join(ls)
open("111.txt", encoding="gbk").close()
open("./resources/111.txt", encoding="gbk").close()
mask = np.array(Image.open("./resources/mask.png"))
wc = wordcloud.WordCloud(font_path="msyh.ttc",
mask=mask,