Export Google BigQuery data to Python Pandas dataframe

I studied how to export BigQuery data in Pandas. There are two methods:

  1. Export the file to CVS and upload it - https://cloud.google.com/bigquery/exporting-data-from-bigquery

  2. Pull data directly into the pandas frame. It doesn't seem to work, but the method is pandas.io.gbq.read_gbq (query, project_id = no, index_col = no, col_order = no, reauth = False). Looks like gbq has been discontinued?

Can someone suggest the best and most efficient way to do this?

Thank.

+6
source share
2 answers

gbq.read_gbq pandas.15.0-1, .14.0-1, (Windows 7). Python, dataframe Google BigQuery, , .

, , , , Google, . (oauth2client.tools.run), .

, : http://pandas-docs.imtqy.com/pandas-docs-travis/io.html#io-bigquery

FYI, dev, ​​ Gcloud, .

+7

Python, google-pandas-load . https://google-pandas-load.readthedocs.io/en/latest/.

:

from google_pandas_load import LoaderQuickSetup
gpl = LoaderQuickSetup(
    project_id='pi', 
    dataset_id='di', 
    bucket_name='bn', 
    local_dir_path='/tmp')

:

df = gpl.load(source='query', destination='pandas', query=query)

, google.cloud.bigquery.job.QueryJob.to_dataframe(). .

0

All Articles