PYTHON Pandas批量读取csv文件到DATAFRAME
首先使用glob.glob获得文件路径。然后定义一个列表,读取文件后再使用concat合并读取到的数据。
#读取数据
import pandas as pd
import numpy as np
import glob,os
path=r'e:\tj\month\fx1806'
file=glob.glob(os.path.join(path, "zq*.xls"))
print(file)
dl= []
for f in f
效果展示
*
python代码
from pyecharts import WordCloud
import pandas as pd
wd = pd.read_csv('cp.csv')
word = [i[0] for i in wd[['关键词']].values]
value = [i[0] for i in wd[['词频']].values]
wordCloud = WordCloud(width=2000, height=2000)
wordCloud.add('词云', wor
1、问题
在使用Python中pandas读取csv文件时,由于文件编码格式出现以下问题:
Traceback (most recent call last):
File pandas\_libs\parsers.pyx, line 1134, in pandas._libs.parsers.TextReader._convert_tokens
File pandas\_libs\parsers.pyx, line 1240, in pandas._libs.parsers.TextRea