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/03/23 17:09:53 UTC

[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #34289: GH-33727: [Python] array() errors if pandas categorical column has dictionary as string not object

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


##########
python/pyarrow/tests/test_array.py:
##########
@@ -3292,9 +3293,22 @@ def __arrow_array__(self, type=None):
 
     arr = MyArray2(np.array([1, 2, 3], dtype='int64'))
     result = pa.array(arr)
-    expected = pa.chunked_array([[1, 2, 3]], type=pa.int64())
+    expected = pa.array([1, 2, 3], type=pa.int64())
     assert result.equals(expected)
 
+    class MyArray3:
+        def __init__(self, data1, data2):
+            self.data1 = data1
+            self.data2 = data2
+
+        def __arrow_array__(self, type=None):
+            return pa.chunked_array([self.data1, self.data2], type=type)
+
+    np_arr = np.array([1, 2, 3], dtype='int64')
+    arr = MyArray3(np_arr, np_arr)
+    result = pa.array(arr)
+    expected = pa.chunked_array([[1, 2, 3], [1, 2, 3]], type=pa.int64())

Review Comment:
   ```suggestion
       expected = pa.chunked_array([[1, 2, 3], [1, 2, 3]], type=pa.int64())
       assert result.equals(expected)
   ```



-- 
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