ValueError:安装DBTYPE用于使用此功能

发布于 2025-02-04 11:24:48 字数 364 浏览 4 评论 0原文

我是第一次使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

演多会厌 2025-02-11 11:24:48

解决此问题的最强大方法是指定您还需要安装 pandas额外的依赖项安装google> google-cloud-bigquery软件包时。 来完成此操作。

  • 您可以通过运行pip install'google-cloud-bigquery [pandas]'
  • 放置eg 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 the google-cloud-bigquery package. You'd do this by

  • running pip install 'google-cloud-bigquery[pandas]', or
  • putting e.g. google-cloud-bigquery[pandas]==2.34.3 in your requirements.txt.
顾铮苏瑾 2025-02-11 11:24:48

我能够复制您的用例,如下所示。

最简单的解决方案是pip install db-dtypes,如@mattdmo所述。

或者,您可以通过创建google-cloud-bigquery来指定上一个版本,通过创建infirmits.txt,其中包含以下内容:

google-cloud-bigquery==2.34.3

然后使用命令使用pip安装,如下所示:

pip install -r /path/to/requirements.txt

我的输出样本复制:

I was able to replicate your use case as shown below.
enter image description here

Easiest solution is to pip install db-dtypes as mentioned by @MattDMo.

Or you can specify previous version of google-cloud-bigquery by creating a requirements.txt with below contents:

google-cloud-bigquery==2.34.3

And then pip install by using command as shown below:

pip install -r /path/to/requirements.txt

Output of my sample replication:
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文