[英]df2gspread Type Error when uploading DF to Google sheets
I'm getting the following error when trying to use d2g.upload() to save a DF back to a Google sheet:尝试使用 d2g.upload() 将 DF 保存回 Google 工作表时出现以下错误:
TypeError: '<' not supported between instances of 'str' and 'int' TypeError:“str”和“int”的实例之间不支持“<”
It is saving the index and the DF column names to the Google sheet, but not actually populating the data into the sheet.它将索引和 DF 列名称保存到 Google 工作表中,但实际上并未将数据填充到工作表中。
No idea what's causing it, has anyone else encountered this same problem?不知道是什么原因造成的,有没有其他人遇到过同样的问题? Below is the code I'm using to save the DF back to Google sheets.
下面是我用来将 DF 保存回 Google 表格的代码。 I've used the same code for several other DF's and it works, I just don't know what's unique and this specific DF that's causing the issue.
我对其他几个 DF 使用了相同的代码并且它有效,我只是不知道什么是独特的以及导致问题的特定 DF。 The Dtypes are all object / float.
Dtypes 都是 object / float。 Any help would be greatly apprecaited!
任何帮助将不胜感激!
from df2gspread import df2gspread as d2g
wks_name = 'Linkedin_Campaign_Ad_Daily_Clean'
d2g.upload(li_ad_link_clicks, spreadsheet_key, wks_name, credentials=credentials, row_names=True)
I fixed this by deleting duplicate columns in my dataframe:我通过删除 dataframe 中的重复列来解决此问题:
df = df.loc[:,~df.columns.duplicated()] df = df.loc[:,~df.columns.duplicated()]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.