pandas.io.gbq.read_gbq

pandas.io.gbq.read_gbq(query, project_id=None, destination_table=None, index_col=None, col_order=None, **kwargs)

Load data from Google BigQuery.

The main method a user calls to load data from Google BigQuery into a pandas DataFrame. This is a simple wrapper for Google’s bq.py and bigquery_client.py, which we use to get the source data. Because of this, this script respects the user’s bq settings file, ‘~/.bigqueryrc’, if it exists. Such a file can be generated using ‘bq init’. Further, additional parameters for the query can be specified as either **kwds in the command, or using FLAGS provided in the ‘gflags’ module. Particular options can be found in bigquery_client.py.

Parameters:

query : str

SQL-Like Query to return data values

project_id : str (optional)

Google BigQuery Account project ID. Optional, since it may be located in ~/.bigqueryrc

index_col : str (optional)

Name of result column to use for index in results DataFrame

col_order : list(str) (optional)

List of BigQuery column names in the desired order for results DataFrame

destination_table : string (optional)

If provided, send the results to the given table.

**kwargs : :

To be passed to bq.Client.Create(). Particularly: ‘trace’, ‘sync’, ‘api’, ‘api_version’

Returns:

df: DataFrame :

DataFrame representing results of query