【发布时间】:2017-08-07 06:45:26
【问题描述】:
案例: 我的脚本返回一个数据框,该数据框必须作为新的数据行附加到现有的谷歌电子表格中。截至目前,我正在通过 gspread 将数据框作为多个单行附加。
我的代码:
import gspread
import pandas as pd
df = pd.DataFrame()
# After some processing a non-empty data frame has been created.
output_conn = gc.open("SheetName").worksheet("xyz")
# Here 'SheetName' is google spreadsheet and 'xyz' is sheet in the workbook
for i, row in df.iterrows():
output_conn.append_row(row)
有没有办法追加整个数据框而不是多个单行?
【问题讨论】:
标签: python pandas dataframe google-sheets gspread