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

[GitHub] [arrow] AlenkaF commented on a diff in pull request #36164: GH-35573: [Python] pa.FixedShapeTensorArray.to_numpy_ndarray fails on sliced arrays

AlenkaF commented on code in PR #36164:
URL: https://github.com/apache/arrow/pull/36164#discussion_r1241605059


##########
python/pyarrow/array.pxi:
##########
@@ -3153,7 +3153,7 @@ class FixedShapeTensorArray(ExtensionArray):
         Note: ``permutation`` should be trivial (``None`` or ``[0, 1, ..., len(shape)-1]``).
         """
         if self.type.permutation is None or self.type.permutation == list(range(len(self.type.shape))):
-            np_flat = np.asarray(self.storage.values)
+            np_flat = np.asarray(self.storage.flatten())

Review Comment:
   The underlying type (storage type) of the `FixedShapeTensor` is a `FixedSizeList` which always has the `flatten()` API:
   https://arrow.apache.org/docs/python/generated/pyarrow.FixedSizeListArray.html#pyarrow.FixedSizeListArray.flatten



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