python-bigquery-pandas icon indicating copy to clipboard operation
python-bigquery-pandas copied to clipboard

nullable numeric column does not handled well

Open codingskynet opened this issue 1 year ago • 0 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

  • Search the issues already opened: https://github.com/googleapis/python-bigquery-pandas/issues
  • Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • pandas-gbq version: 0.19.2

Steps to reproduce

Try to_gbq with nullable Decimal rows. It does not handle None or pd.NA since it always tries to cast value into Decimal whatever it is None or not: https://github.com/googleapis/python-bigquery-pandas/blob/main/pandas_gbq/load.py#L61-L109

Code example

df = pd.DataFrame(results)
df.to_gbq(
    'table,
    'namespace',
    if_exists='append',
    credentials=credentials,
)

codingskynet avatar Jan 05 '24 04:01 codingskynet