Skip to content

Commit 26d90ab

Browse files
authored
Update tests to support conversion of NaN as NULL in pyarrow 0.14.*. (#8785)
* Treat NaN as NULL when converting from pandas to arrow. Fixes broken unit tests from latest pyarrow release. * Remove outdated pyarrow comment.
1 parent 4d9fa14 commit 26d90ab

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bigquery/noxfile.py

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def default(session):
3838
for local_dep in LOCAL_DEPS:
3939
session.install("-e", local_dep)
4040

41-
# Pyarrow does not support Python 3.7
4241
dev_install = ".[all]"
4342
session.install("-e", dev_install)
4443

bigquery/tests/unit/test__pandas_helpers.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,10 @@ def test_bq_to_arrow_array_w_special_floats(module_under_test):
488488
roundtrip = arrow_array.to_pylist()
489489
assert len(rows) == len(roundtrip)
490490
assert roundtrip[0] == float("-inf")
491-
assert roundtrip[1] != roundtrip[1] # NaN doesn't equal itself.
491+
# Since we are converting from pandas, NaN is treated as NULL in pyarrow
492+
# due to pandas conventions.
493+
# https://arrow.apache.org/docs/python/data.html#none-values-and-nan-handling
494+
assert roundtrip[1] is None
492495
assert roundtrip[2] == float("inf")
493496
assert roundtrip[3] is None
494497

0 commit comments

Comments
 (0)