0
df1:

Name   Company  Desgn   Date         Salary
Rick   JKA      HR      2020-07-21   52
Nick   lka      Engg    2020-07-21   65
John   SDK      HR      2020-07-21   75

df2:

Name   Company  Desgn  
Rick   JKA      HR     
Nick   lka      Engg  
John   SDK      HR

嗨,我需要将 df1 和 df2 写入 biq 查询表,基本上使用谷歌云功能将两个数据帧附加到表中。我可以写 df1 但它给出了 df2 的错误。

code:
lst = [df1,df2]
for i in lst:
   i.to_gbq('dataset.table',project_id="project_id",if_exists='append')


error: "Please verify that the structure and data types in the DataFrame match the schema of the destination table." 
4

1 回答 1

0

您可以具有相同的 df 结构和架构,但对日期和薪水使用空值

df2
Name   Company  Desgn   Date         Salary
Rick   JKA      HR      null         null
Nick   lka      Engg    null         null
John   SDK      HR      null         null

您还可以将 df1 附加到 df2 df1:

Name   Company  Desgn   Date         Salary
Rick   JKA      HR      2020-07-21   52
Nick   lka      Engg    2020-07-21   65
John   SDK      HR      2020-07-21   75
Rick   JKA      HR      null         null
Nick   lka      Engg    null         null
John   SDK      HR      null         null
于 2021-08-17T00:06:42.037 回答