import pandas
import csv
import jieba
import numpy
from PIL import Image
from wordcloud import WordCloud
defgetDataFromCsv():# 设置星级等级
comments =[]# 打开表格,"r"读取模式 读取数据withopen(r"E:\01_hjz\datas\01_ml\paulmadanmaku.csv","r",encoding="utf-8")asfile:# 表格操作读数据
reader = csv.reader(file)# 遍历表格里得到所有数据 next(reader)#从第二行开始读取for i in reader:# 如果没有星级
comments.append(i)print(comments)file.close()# 将装有数据的列表返回出来return comments
getDataFromCsv()
[['0 days 00:01:16.562000000','2020-01-05','2020-01','2020-01-05 15:58:45','你要感谢人家小伙子点到为止,不然你眼睛保不住。','7ecdfd8'],['0 days 00:00:59.156000000','2020-05-18','2020-05','2020-05-18 04:49:33','已经被打死了','fb2f37fe'],...]
Dumping model to file cache C:\Users\ADMINI~1\AppData\Local\Temp\jieba.cache
Loading model cost 0.605 seconds.
Prefix dict has been built successfully.