You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jorisvandenbossche (via GitHub)" <gi...@apache.org> on 2023/06/21 13:22:07 UTC

[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #35944: GH-36168: [C++][Python] Support halffloat for Arrow list to pandas

jorisvandenbossche commented on code in PR #35944:
URL: https://github.com/apache/arrow/pull/35944#discussion_r1236995552


##########
python/pyarrow/tests/test_array.py:
##########
@@ -3347,6 +3347,17 @@ def test_to_pandas_timezone():
     assert s.dt.tz is not None
 
 
+@pytest.mark.pandas
+def test_to_pandas_float16_list():
+    # https://github.com/apache/arrow/issues/36168
+    arr = pa.array([[np.float16(1)], [np.float16(2)], [np.float16(3)]])
+    s = arr.to_pandas()
+    assert s is not None
+    base_refcount = sys.getrefcount(s.values.base)
+    assert base_refcount == 2

Review Comment:
   What's the reason for checking the ref count?
   
   I think you can create the expected result using numpy: `expected = np.array([1, 2, 3], dtype="float16")`, and then check that the result is the same.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org