如何解决ValueError:无法将[-0.2、29.0、0.0、0.0、33.38]转换为Excel Python 3 Openpyxl
好的,所以我正在与Pandas和Openpyxl一起尝试读取现有的excel文件以获取一些行,以便将这些行添加到另一个excel文件中的数据库中,问题是尝试时出现错误从两个文件附加数据。有什么建议?非常感谢您的宝贵时间。
# directorioOrigen = contains the path of the file from origin
# directorioDestino = contains the path of the file of destination (Excel database)
# entryTags = a list of Strings that represents the header names of columns the user needs to # obtain from the origin file
def ProcesarArchivo(directorioOrigen,directorioDestino,entryTags):
listaTags = entryTags.get()
archivo = pd.read_excel(directorioOrigen,skiprows=9,index_col='Timestamp')
listaTags = listaTags.split(',')
for i in range(len(listaTags)):
listaTags[i] = listaTags[i].strip()
dataCruda = archivo[listaTags]
dataCruda = dataCruda.values.tolist()
destino = op.load_workbook(directorioDestino)
sheet = destino.get_sheet_by_name('Data cruda')
sheet.append(dataCruda)
destino.save(directorioDestino)
MensajeExito()
我得到的错误:
raise ValueError("Cannot convert {0!r} to Excel".format(value))
ValueError: Cannot convert [-0.2,29.0,0.0,33.38] to Excel
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。