首页 > 解决方案 > Append Row to Google Spreadsheet-->TypeError: keys must be a string

问题描述

我正在尝试将一行附加到 google 电子表格,但出现错误。通常它可以工作,但现在它说:

TypeError: keys must be a string

有谁知道这意味着什么?

这是我的代码和我尝试插入的所有数据类型的打印。电子表格的 numpy 类型或布尔值是否存在问题?

for e in range(experiments):
    #types: <class 'int'>,<class 'str'>,<class 'numpy.str_'>,<class 'float'>,<class 'int'>,<class 'int'>,<class 'numpy.float64'>,<class 'numpy.float64'>,<class 'numpy.float64'>,<class 'int'>,<class 'collections.defaultdict'>,<class 'int'>,<class 'int'>,<class 'float'>,<class 'bool'>

    insertRow=[training,gameList[e],stateList[e], eps, experiments,timesteps,min_rewardList[e],maxRewList[e],total_rewList[e],currentMaxXList[e],maxXList[e],frames_stack,mb_size,learning_rate,completed_levelList[e]]
    sheet.append_row(insertRow)

标签: pythongoogle-sheetsrowtypeerror

解决方案


推荐阅读