【发布时间】:2017-05-25 04:07:29
【问题描述】:
我想在 datalab 上使用来自 bigquery 的公共数据,然后将其转换为 pandas 数据框。我该怎么做。我尝试了 3 个不同的版本:
from google.cloud import bigquery
client = bigquery.Client()
QUERY = (
'SELECT pickup_datetime, dropoff_datetime FROM `bigquery-public-
data.new_york.tlc_yellow_trips_20*`') --also tried without the ` and wildcard
query = client.run_sync_query('%s LIMIT 100' % QUERY)
query.timeout_ms = 10000
query.run()
错误:错误请求
import pandas as pd
df=pd.io.gbq.read_gbq("""
SELECT pickup_datetime, dropoff_datetime
FROM bigquery-public-data.new_york.tlc_yellow_trips_20*
LIMIT 10
""", project_id='bigquery-public-data')
错误:我被要求授予对 pandas 的访问权限,但当我同意时,我得到This site can’t be reached localhost refused to connect。
%%bq query
SELECT pickup_datetime, dropoff_datetime
FROM bigquery-public-data.new_york.tlc_yellow_trips_20*
LIMIT 10
错误:只保留Running
对我做错的任何帮助将不胜感激。
【问题讨论】:
标签: pandas google-bigquery google-cloud-datalab