简体   繁体   中英

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:

TypeError: '<' not supported between instances of 'str' and 'int'

It is saving the index and the DF column names to the Google sheet, but not actually populating the data into the sheet.

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. 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. The Dtypes are all 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:

df = df.loc[:,~df.columns.duplicated()]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM