将数据框附加到现有的谷歌工作表,其中包含数据而不覆盖数据
我有一个现有的工作表,其中一列中包含我从数据框中填充的数据。我想采用不同的数据框并填充工作表中的第二列,但很难理解如何做到这一点。最终发生的情况是它覆盖了第一列中的数据。
我在工作表中的列目前看起来像这样,
Ilastik
0.1111082937
0.1744560321
0.1370938026
0.1028610827
0.6465271181
0.1871931638
0.1105310022
0.2431738711
0.4100191368
0.4919283379
我希望它看起来像
Ilastik Kmeans
0.1111082937 0.473713
0.1744560327 0.359408
0.1370938026 0.368002
0.1028610827 0.219979
两个数据都来自不同的数据框。我使用打开了我的工作表
worksheet_hemp_kmeans = sh.worksheet("Hemp Model Results")
,然后尝试向其中添加数据框。 hemp_kmeans_df2 是我要添加的数据框。
worksheet_hemp_kmeans.update([hemp_kmeans_df2.columns.values.tolist()] +hemp_kmeans_df2.values.tolist())
I have an existing worksheet that has data in one column that I have populated from a data frame. I want to take a different data frame and populate the second column in the worksheet but struggling to understand how to do it. What ends up happening is that it overwrites the data in the first column.
My column in the worksheet currently looks like this
Ilastik
0.1111082937
0.1744560321
0.1370938026
0.1028610827
0.6465271181
0.1871931638
0.1105310022
0.2431738711
0.4100191368
0.4919283379
I want it to look like
Ilastik Kmeans
0.1111082937 0.473713
0.1744560327 0.359408
0.1370938026 0.368002
0.1028610827 0.219979
Both data have come from different dataframes. I opened my worksheet using
worksheet_hemp_kmeans = sh.worksheet("Hemp Model Results")
And then tried adding the dataframe to it. hemp_kmeans_df2 is my dataframe that I want to add.
worksheet_hemp_kmeans.update([hemp_kmeans_df2.columns.values.tolist()] +hemp_kmeans_df2.values.tolist())
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
谢谢你,我成功地做到了
Thank you I managed to work it by doing