From 1ae14b64ad993ef677646c21e02148fbf2e68a8c Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 25 Jul 2019 14:13:16 -0700 Subject: [PATCH 1/2] Treat NaN as NULL when converting from pandas to arrow. Fixes broken unit tests from latest pyarrow release. --- bigquery/tests/unit/test__pandas_helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bigquery/tests/unit/test__pandas_helpers.py b/bigquery/tests/unit/test__pandas_helpers.py index 13cfab71e74c..9348635f2dc6 100644 --- a/bigquery/tests/unit/test__pandas_helpers.py +++ b/bigquery/tests/unit/test__pandas_helpers.py @@ -488,7 +488,10 @@ def test_bq_to_arrow_array_w_special_floats(module_under_test): roundtrip = arrow_array.to_pylist() assert len(rows) == len(roundtrip) assert roundtrip[0] == float("-inf") - assert roundtrip[1] != roundtrip[1] # NaN doesn't equal itself. + # Since we are converting from pandas, NaN is treated as NULL in pyarrow + # due to pandas conventions. + # https://arrow.apache.org/docs/python/data.html#none-values-and-nan-handling + assert roundtrip[1] is None assert roundtrip[2] == float("inf") assert roundtrip[3] is None From c01609d3a5b7af8de439a750fcc73db443ab310d Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 25 Jul 2019 14:38:31 -0700 Subject: [PATCH 2/2] Remove outdated pyarrow comment. --- bigquery/noxfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bigquery/noxfile.py b/bigquery/noxfile.py index a9df7a67cfcc..9cfe5cc856dd 100644 --- a/bigquery/noxfile.py +++ b/bigquery/noxfile.py @@ -38,7 +38,6 @@ def default(session): for local_dep in LOCAL_DEPS: session.install("-e", local_dep) - # Pyarrow does not support Python 3.7 dev_install = ".[all]" session.install("-e", dev_install)