0

This is the typical connection I have from my local device:

from google.cloud import bigquery
from google.oauth2 import service_account

credentials_path = "credential path"
credentials = service_account.Credentials.from_service_account_file(credentials_path) 
project_id = "project id"
client = bigquery.Client(credentials=credentials, project=project_id)
sql_query ="SELECT * FROM table"
query_job = client.query(sql_query)
results = query_job.result()

Until there everything runs nice, but here:

df = results.to_dataframe()

I get this error:

enter image description here

And I haven't been able to solve it. I have found some questions (1,2) that are pretty similar but don't have an accepted answer. In my problem, I have that package installed, so it seems that google cloud is not able to import that package? Any suggestions?

Chris
  • 2,019
  • 5
  • 22
  • 67

1 Answers1

0

Use google-cloud-bigquery[pandas] as requirement instead of google-cloud-bigquery.

For installing it: pip install google-cloud-bigquery[pandas]

dnnshssm
  • 1,057
  • 6
  • 17