RT,选修课的题目(之前提问过)现在遇到的问题。每个 csv 文件列索引是一样的,有一列是 label,其他是属性。
1
renmu 2019-07-03 19:39:08 +08:00 via Android 1
pandas 直接 read_csv()
|
4
zhucegeqiu 2019-07-03 21:10:51 +08:00 via iPhone 1
先 os.listdir, 再 pd.read_csv
|
5
amoy OP @renmu @zhucegeqiu 打扰一下
listaddress=[] for info in os.listdir('F:/bigdata/data/all'): domain = os.path.abspath(r'F:/bigdata/data/all') # 获取文件夹的路径 info = os.path.join(domain, info) # 将路径与文件名结合起来就是每个文件的完整路径 listaddress.append(info) dfs =[pd.read_csv(f) for f in listaddress] #print(dfs[1]) df = pd.concat(dfs) # 将文件合并 请问运行报错是是为什么啊? FutureWarning: Sorting because non-concatenation axis is not aligned. A future version of pandas will change to not sort by default. To accept the future behavior, pass 'sort=False'. To retain the current behavior and silence the warning, pass 'sort=True'. |