Skip to content

Commit

Permalink
Update tests to support conversion of NaN as NULL in pyarrow 0.14.*. (
Browse files Browse the repository at this point in the history
#8785)

* Treat NaN as NULL when converting from pandas to arrow.

Fixes broken unit tests from latest pyarrow release.

* Remove outdated pyarrow comment.
  • Loading branch information
tswast authored Jul 25, 2019
1 parent 4d9fa14 commit 26d90ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion bigquery/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion bigquery/tests/unit/test__pandas_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 26d90ab

Please sign in to comment.