[英]python df2gspread.d2g.upload: How can I upload datefram column with data type integer
is there any way I can use the d2g upload data frame without change all the data type to string?有什么方法可以在不将所有数据类型更改为字符串的情况下使用 d2g 上传数据框? enter image description here
在此处输入图像描述
enter image description here在此处输入图像描述
the data type changed when I uploaded it to google sheet, how can I keep the original data type.当我将它上传到谷歌表格时数据类型发生了变化,我怎样才能保持原始数据类型。
I got the exact same problem.我遇到了完全相同的问题。 You should try using gspread-pandas instead.
您应该尝试改用 gspread-pandas。 In my experience it works a lot faster than d2g.
以我的经验,它的运行速度比 d2g 快得多。 The installation guide is here
安装指南在这里
First, you should put your credentials file in the right directory.首先,您应该将凭证文件放在正确的目录中。 If you don't know where it is, you can try this
如果你不知道它在哪里,你可以试试这个
from gspread_pandas import Spread
x= Spread(work_sheet_id, worksheet_name)
An error message will show up and tell you where the directory is and that you should rename your credentials as google_secret.json and put it there.将显示一条错误消息并告诉您目录在哪里,您应该将您的凭据重命名为 google_secret.json 并将其放在那里。
After that you can upload into an existing sheet or create a new one:之后,您可以上传到现有工作表或创建新工作表:
x.df_to_sheet(df, index=False, sheet=worksheet_name, replace=True)
The documentation is here if you want to find out more about what parameter values you should use.如果您想了解有关应使用哪些参数值的更多信息,请参阅此处的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.