2017-08-11
On the official Google Cloud Datalab quickstart, Google gives you the detailed steps about how to start a GCP instance running the Jupyter notebook, where you'll experiment all the functionalities of the Datalab.
But, perhaps you don't want to pay the price of the instance. You don't need to use the cloud for that, since you have your own computer. In this case, to get a Datalab instance on your computer, you just need docker.
docker run -it -p "127.0.0.1:8081:8080" -v $PWD:"/content" gcr.io/cloud-datalab/datalab:local
But let's admit that you have a BigQuery dataset, with which you want to play. To access easily that data from the Datalab notebook as if you were on a dedicated instance, you'll have to:
credentials.json to the datalab/.config folderexport GOOGLE_APPLICATION_CREDENTIALS=/content/datalab/.config/credentials.jsondocker run -it -p "127.0.0.1:8081:8080" -v $PWD:"/content" gcr.io/cloud-datalab/datalab:local%projects set yourprojectNow you're ready to play with your dataset. For example:
%%sql --module records SELECT field1, field2, field3, field4 FROM dataset.tableimport datalab.bigquery as bq df = bq.Query(records).to_dataframe()Congratulations! You have now a working pandas dataset ;-)