3Mcollab
3Mcollab

Reputation: 111

Issues with pytest for Bigquery Dataframe

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?

Upvotes: 0

Views: 143

Answers (1)

3Mcollab
3Mcollab

Reputation: 111

You can use a.empty, a.bool(), a.item(), a.any() or a.all() with the dataframe.

Upvotes: 0

Related Questions