spenczar commented on issue #35622:
URL: https://github.com/apache/arrow/issues/35622#issuecomment-1561313124

   > The problem is that to_numpy() for a fixed size list array doesn't give 
you this flat (or nd) array of the values, but an object dtype array of 
sub-arrays.
   
   True, but is this desirable? I can't think of a scenario where that is a 
useful return shape. In practice, my group currently always reshapes that into 
a 2D array.
   
   FixedShapeTensorArray has a `to_numpy_ndarrray` method which addresses this 
usage issue: 
https://github.com/apache/arrow/blob/f45a9e57dfcabe73b341f0e0504f7e8210988dad/python/pyarrow/array.pxi#L3149-L3161
   
   Maybe a solution is for FixedSizeListArray to have a to_numpy_ndarray 
method? It'd be a somewhat crummy API, since you'd almost never want to use 
`to_numpy`, but it'd preserve the current behavior.
   
   > Sidenote, there is actually another API to directly get this numpy array, 
without having to go through the buffers manually:
   
   Very useful to know, thanks! I'll add an issue that those should be 
documented for the ListArray, LargeListArray, and FixedSizeListArray types (see 
https://arrow.apache.org/docs/python/generated/pyarrow.FixedSizeListArray.html#pyarrow.FixedSizeListArray.values).


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to