pandas to_excel TypeError:不受支持的类型< type'list'>在write()中 [英] pandas to_excel TypeError: Unsupported type <type 'list'> in write()

查看:92
本文介绍了pandas to_excel TypeError:不受支持的类型< type'list'>在write()中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据框,正在尝试将其导出到excel中.我正在使用以下代码:

I have a dataframe and I am trying to export it in excel. I am using the following code:

outcome = merge(sql, emptydf, on='sku', how='left')

writer = pd.ExcelWriter('casafina_json.xlsx', engine='xlsxwriter')
outcome.to_excel(writer, sheet_name='Sheet1')
writer.save()

当我运行它时,出现此错误:

when I run it I get this error:

raise TypeError("Unsupported type %s in write()" % type(token))

TypeError: Unsupported type <type 'list'> in write()

怎么了?谢谢.

两个数据框所连接的列没有唯一值.我认为这可能是错误的原因.关于如何以不同的方式加入他们的任何想法吗?

the column on which the two dataframes were joint does not have unique values. I think this may be the cause of the error. Any idea on how to join them differently?

推荐答案

我仍然不知道出什么问题了.但是,可以使用以下功能创建一个csv:

I still don't know what is wrong. However, it is possible to create a csv out of it with the function:

outcome.to_csv('/Users/whatever/whatever.csv')

这篇关于pandas to_excel TypeError:不受支持的类型&lt; type'list'&gt;在write()中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆