ValueError:安装DBTYPE用于使用此功能
我是第一次使用BigQuery。
client.list_rows(table, max_results = 5).to_dataframe();
每当我使用to_dataframe()时,会引起此错误:
valueerror:请安装“ db-dtypes”软件包以使用此功能。
我发现这个类似的问题(几乎完全相同),但我不能了解如何实施他们提出的解决方案。
I'm using BigQuery for the first time.
client.list_rows(table, max_results = 5).to_dataframe();
Whenever I use to_dataframe() it raises this error:
ValueError: Please install the 'db-dtypes' package to use this function.
I found this similar problem (almost exactly the same), but I can't understand how to implement their proposed solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决此问题的最强大方法是指定您还需要安装
pandas
额外的依赖项安装google> google-cloud-bigquery
软件包时。 来完成此操作。pip install'google-cloud-bigquery [pandas]'
或google
google-cloud-bigquery [pandas] == 2.34.3
在您的要求中。txt
。The most robust way to resolve this is to specify that you also want to install the
pandas
extra dependencies when installing thegoogle-cloud-bigquery
package. You'd do this bypip install 'google-cloud-bigquery[pandas]'
, orgoogle-cloud-bigquery[pandas]==2.34.3
in yourrequirements.txt
.我能够复制您的用例,如下所示。

最简单的解决方案是
pip install db-dtypes
,如@mattdmo所述。或者,您可以通过创建
google-cloud-bigquery
来指定上一个版本,通过创建infirmits.txt
,其中包含以下内容:然后使用命令使用pip安装,如下所示:
我的输出样本复制:

I was able to replicate your use case as shown below.

Easiest solution is to
pip install db-dtypes
as mentioned by @MattDMo.Or you can specify previous version of
google-cloud-bigquery
by creating arequirements.txt
with below contents:And then pip install by using command as shown below:
Output of my sample replication:
