Locally, I can get dataframe with Bigquery in Notebook and.py file.
However, while testing using pytest
bq=bigquery.Client(project='xyz')
query_string="SELECT *FROM <table_name>"
df = bq.query(str(query_string)).result().to_dataframe()
assert df
It will through an error
@Final def nonzero(self): raise ValueError(
f"The truth value of a {type(self).__name__} is ambiguous. "
"Use a.empty, a.bool(), a.item(), a.any() or a.all()."
)
E ValueError: The truth value of a Index is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
/opt/conda/lib/python3.7/site-packages/pandas/core/indexes/base.py:2574: ValueError
How we can hide this error message or it is some bug with pytest?
You can use a.empty, a.bool(), a.item(), a.any() or a.all() with the dataframe.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.