You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/08/10 11:42:48 UTC

[GitHub] [arrow] kszucs commented on a change in pull request #7868: ARROW-9429: [Python] ChunkedArray.to_numpy

kszucs commented on a change in pull request #7868:
URL: https://github.com/apache/arrow/pull/7868#discussion_r467847573



##########
File path: python/pyarrow/table.pxi
##########
@@ -226,24 +226,34 @@ cdef class ChunkedArray(_PandasConvertible):
     def _to_pandas(self, options, **kwargs):
         return _array_like_to_pandas(self, options)
 
-    def __array__(self, dtype=None):
+    def to_numpy(self):
+        """
+        Return a NumPy copy of this array (experimental).
+
+        Returns
+        -------
+        array : numpy.ndarray
+        """
         cdef:
             PyObject* out
             PandasOptions c_options
             object values
 
         if self.type.id == _Type_EXTENSION:
-            return (
-                chunked_array(
-                    [self.chunk(i).storage for i in range(self.num_chunks)]
-                ).__array__(dtype)
-            )
+            storage_array = chunked_array([
+                chunk.storage for chunk in self.iterchunks()
+            ])

Review comment:
       Need to pass the type explicitly, fixing it.




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

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