【发布时间】:2016-07-06 15:52:39
【问题描述】:
我正在尝试将 pandas 数据框列表导出到 excel
list_of_df_to_dump = [df1,df2,...,df100]
list_of_tab_names = ['df1','df2',...,'df100']
writer = ExcelWriter(excel_name + '.xlsx')
for i,j in list_of_df_to_dump,list_of_tab_names:
i.to_excel(writer,j,index = False)
writer.save()
我收到以下错误:
TypeError: 'DataFrame' objects are mutable, thus they cannot be hashed
关于如何解决此问题或完成相同事情的替代方法有什么想法吗?我不知道列表要手动执行多久
【问题讨论】:
-
您的 for 语句不正确。试试看:
for i,j in zip(list_of_df_to_dump,list_of_tab_names): -
很奇怪。编造一些数据来测试你的代码我得到了一个 ValueError ,正如我所料。请发帖minimal reproducible example。
标签: python excel pandas xlsxwriter