How to use read_gbq or another bq in IPython to access datasets hosted in BigQuery

I am using iPython notebook to read public google BigQuery dataset for natality I did setup for google-api easy_install --upgrade google-api-python-client

.

However, it still doesn't detect the installed API

Everyone has an iPython notebook to share when accessing a public dataset and uploading it to the framework in iPython.

import pandas as pd
projectid = "xxxx"
data_frame = pd.read_gbq('SELECT * FROM xxxx', project_id = projectid)

    303     if not _GOOGLE_API_CLIENT_INSTALLED:
--> 304         raise ImportError('Could not import Google API Client.')
    305 
    306     if not _GOOGLE_FLAGS_INSTALLED:

ImportError: Could not import Google API Client

      

I have shared the iPython Notebook entry used at http://nbviewer.ipython.org/urls/dl.dropbox.com/s/d77u2xarscagw0b/BigQuery_Trial8.ipynb?dl=0

Additional info: I am running on a server with a docker instance used for iPython server. I ran curl https://sdk.cloud.google.com | bash on Linux server

I tried to run some of the generic notebooks nbviewer.ipython.org/gist/fhoffa/6459195 or nbviewer.ipython.org/gist/fhoffa/6472099 However, I also get ImportError: No module named bq

I suspect this is a simple case of missing dependencies. Anyone with a hint is welcome

+3


source to share


2 answers


As I just said here: fooobar.com/questions/70825 / ... I solved the problem with this:



pip install --force-reinstall uritemplate.py

      

+1


source


Make sure your Pandas is 0.17 or higher:

pip install -U pandas



You can check:

import pandas as pd
pd.__version__

      

0


source







All Articles