Alex
Alex

Reputation: 1537

bigquery pandas df on datalab

I want to use pandas to pull from bigquery in datalab. However, something doesn't work. I'm using Python 2.7

query = "select * from myTable"

df_train = pd.read_gbq(project_id='my_project', query=query, dialect='standard'

I get this error:

ImportError: pandas requires google-cloud-python for Google BigQuery support: cannot import name make_exception

How can I use pandas?

Upvotes: 1

Views: 5056

Answers (1)

Charles Landau
Charles Landau

Reputation: 4265

The docs say you need pandas-gbq to get this done, and that you need to have some auth happening somewhere. Install pandas-gbq with pip install pandas-gbq or conda install pandas-gbq to address the error you pasted, and also ensure auth is happening either by passing a private_key arg to read_gbq or by setting the defaults as described in the docs.

Upvotes: 1

Related Questions