将iqy文件与python合并

将iqy文件与python合并,python,excel,pandas,merging-data,Python,Excel,Pandas,Merging Data,目前,我从sharepoint中提取数据,并拥有可以用excel打开的.iqy文件。大约有30个文件,我正试图用python将所有信息合并成一个.iqy文件或excel文件 import os, glob import pandas as pd files = [] for file in os.listdir("C:\\Users\\CHI86786\\Downloads"): files.append(file) excels = [pd.ExcelFile(name) for

目前,我从sharepoint中提取数据,并拥有可以用excel打开的.iqy文件。大约有30个文件,我正试图用python将所有信息合并成一个.iqy文件或excel文件

import os, glob
import pandas as pd

files = []
for file in os.listdir("C:\\Users\\CHI86786\\Downloads"):
    files.append(file)

excels = [pd.ExcelFile(name) for name in files]
frames = [x.parse(x.sheet_names[0], header=None, index_col=None) for x in excels]

frames[1:] = [df[1:] for df in frames[1:]]

combined = pd.concat(frames)
combined.to_excel("SPmerged.iqy", header=False, index=False)
采用与合并excel文件相同的方法。但我一直收到一个错误,它的内容是
FileNotFoundError:[Errno 2]没有这样的文件或目录:“desktop.ini”

编辑

更多错误消息

File "C:\Users\CHI\source\repos\MergingExcel\MergingExcel\MergingExcel.py", line 8, in <module>
    excels = [pd.ExcelFile(name) for name in files] #reads names in
  File "C:\Users\CHI86786\source\repos\MergingExcel\MergingExcel\MergingExcel.py", line 8, in <listcomp>
    excels = [pd.ExcelFile(name) for name in files] #reads names in
  File "C:\Users\CHI\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\excel.py", line 394, in __init__
    self.book = xlrd.open_workbook(self._io)
  File "C:\Users\CHI\AppData\Local\Programs\Python\Python37-32\lib\site-packages\xlrd\__init__.py", line 116, in open_workbook
    with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'desktop.ini'
文件“C:\Users\CHI\source\repos\MergingExcel\MergingExcel\MergingExcel.py”,第8行,在
excels=[pd.ExcelFile(name)表示文件中的名称]#读取文件中的名称
文件“C:\Users\CHI86786\source\repos\MergingExcel\MergingExcel\MergingExcel.py”,第8行,在
excels=[pd.ExcelFile(name)表示文件中的名称]#读取文件中的名称
文件“C:\Users\CHI\AppData\Local\Programs\Python\Python37-32\lib\site packages\pandas\io\excel.py”,第394行,在\uuu init中__
self.book=xlrd.open_工作簿(self._io)
文件“C:\Users\CHI\AppData\Local\Programs\Python\Python37-32\lib\site packages\xlrd\\uuuu init\uuuu.py”,第116行,在OpenU工作簿中
打开(文件名为“rb”)作为f:
FileNotFoundError:[Errno 2]没有这样的文件或目录:“desktop.ini”

您的代码正试图作用于
C:\Users\CHI86786\Downloads
中的每个文件,包括“desktop.ini”等系统文件

相反,请尝试将其限制为您感兴趣的文件:


错误应该不止这些,并且应该告诉您代码中的问题在哪里。我的意思是它确实说了它在哪里,但它指向模块或内置python脚本(我在原始posti中添加了更多错误),因此我不确定
'desktop.ini'
从哪里来供参考,如果pd.ExcelFile将处理iqy文件,我会非常惊讶,因此我认为整个方法都不可行。仅供参考,只需将代码粘贴到文本框中,高亮显示它,然后按Cmd-K(或者我想在Windows上按Ctrl-K)将其缩进以显示代码。另一种选择是在一行上放置三个回勾,粘贴内容,然后在另一行上再放置三个回勾。看你是对的,这是一种不受支持的格式@DSMYup有效,并向我表明它是一种不受支持的格式。我想这些文件是用excel打开的,所以我可以采用这种方法。我不知道IQY文件是什么,可能只是一个带有专有扩展名的CSV文件或其他什么。它是一个internet查询文件。是的,我花了些时间去看看是什么。我将尝试将它们转换为xlsx,并给你们一个更新
for file in glob.glob("C:\\Users\\CHI86786\\Downloads\\*.iqy")