Can't use Pandas to upload a REPEATED field (e.g. list of strings) #913
Labels
api: bigquery
Issues related to the googleapis/python-bigquery API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
I am trying to add a list of strings stored in a pandas Dataframe to a BigQuery table with a
REPEATED
field. When running this code:I get this error:
Which stops the execution, and does not allow the code to upload to bigquery. I can confirm that if I run the same code without the list element (aka.
df = pd.DataFrame([{"not_repeated": "a_string"}])
, the error does not occur.I think this can be traced back to the recently changed line
if pandas.isna(value):
from this previous PR (use pandas function to check for NaN #750) to solve this previous issue (dataframe_to_json_generator doesn't support pandas.NA type #729 ). As evaluatingpandas.isna(value)
on a list will give an array of bools, which can then not be interpreted by theif
statement.I can confirm that if I go to an older version of this library before this change was made, the code works.
Environment details
google-cloud-bigquery
version: 2.24.0The text was updated successfully, but these errors were encountered: