google-bigquery - import pyarrow not working <- error is "ValueError: The pyarrow library is not installed, please install pyarrow to use the to_arrow() function."
问题描述
我尝试在终端和 juypter lab 中安装它,它说它已成功安装,但是当我运行 df = query_job.to_dataframe() 时,我不断收到错误“ValueError:未安装 pyarrow 库,请安装 pyarrow使用 to_arrow() 函数。”。我不知道如何解决这个问题。有什么建议吗?我正在尝试最终使用代码从谷歌数据工作室访问数据,
from google.cloud import bigquery
import pandas
import numpy
import pyarrow
bigquery_client = bigquery.Client()
import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] ='full file path here.json'
QUERY = """
SELECT *
FROM `warehouse`
LIMIT 100
"""
query_job = bigquery_client.query(QUERY)
df = query_job.to_dataframe()
解决方案
ModuleNotFoundError: No module named 'pyarrow'
在测试您的 Python 代码时,我收到了相同的错误消息。pyarrow
使用 . 安装依赖项后,此行为消失了pip install pyarrow
。
编辑:一旦我在运行后重新启动内核,它就对我有用pip install pyarrow
推荐阅读
- r - 在选择函数之外使用starts_with() 来定义向量
- if-statement - 当代码为真时必须运行时,如何避免在(if,if else)语句中对相同的代码进行两次编码?
- ios - 使用 wkebview 响应对 html 元素的触摸
- php - 将 Rest API 调用从 PHP 转换为 RUBY
- pdf - 将列表数据插入到 itext7 pdf 中的表中(xamarin android)
- c# - SHQueryRecycleBin 在 .net Core 上不起作用
- python - 为什么我不能在 FastApi swagger ui 中授权 api 调用,其中可以使用 postman 授权和调用相同的 api?
- node.js - JsonWebTokenError: jwt malformed: can't verify my Webtoken
- python - 为什么 groupby 数据框在应用 quantile 函数后变成一个系列?
- python - Running video in Python using VLC and PyQt doesn't start