简体   繁体   English

将Numpy矩阵从DataLab上传到BigQuery

[英]Upload Numpy matrix from DataLab to BigQuery

I have a numpy matrix as output in DataLab. 我在DataLab中有一个numpy矩阵作为输出。 How can I get it as a table in BigQuery? 如何在BigQuery中将其作为表格获取?

so far it seems that I need to translate it into JSON, save in the Storage and upload from there. 到目前为止,似乎我需要将其转换为JSON,保存在Storage中并从那里上传。 Is there a simpler way to get this done? 有没有更简单的方法可以做到这一点?

Thanks 谢谢

Found a simple solution with pandas package. pandas包找到了一个简单的解决方案。

Need to transform the data to dataframe and use then to_gbq approach. 需要将数据转换为数据帧,然后使用to_gbq方法。

Here is the documentation 是文档

The only downside is that that the records stay for hours if not days in BigQuery's streaming buffer and I'm not sure what is the impact of it. 唯一的缺点是,这些记录在BigQuery的streaming buffer保留数小时甚至数天,而且我不确定它会带来什么影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM