You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2022/01/24 13:33:00 UTC

[jira] [Commented] (ARROW-5645) [Python] Support inferring nested ndarray with ndim > 1

    [ https://issues.apache.org/jira/browse/ARROW-5645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17481087#comment-17481087 ] 

Joris Van den Bossche commented on ARROW-5645:
----------------------------------------------

While we also don't yet support converting a nd array to fixed sized list array in {{pa.array(..)}}, you can actually convert it manually:

{code}
In [39]: arr = np.arange(30).reshape(10, 3)

In [40]: arr
Out[40]: 
array([[ 0,  1,  2],
       [ 3,  4,  5],
       [ 6,  7,  8],
...

In [41]: pa.array(arr)
...
ArrowInvalid: only handle 1-dimensional arrays

In [42]: pa.FixedSizeListArray.from_arrays(arr.ravel(order="C"), arr.shape[1])
Out[42]: 
<pyarrow.lib.FixedSizeListArray object at 0x7f4025471040>
[
  [
    0,
    1,
    2
  ],
  [
    3,
    4,
    5
  ],
  [
    6,
    7,
    8
  ],
...
{code}

> [Python] Support inferring nested ndarray with ndim > 1
> -------------------------------------------------------
>
>                 Key: ARROW-5645
>                 URL: https://issues.apache.org/jira/browse/ARROW-5645
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Wes McKinney
>            Priority: Major
>
> Follow up work to ARROW-4350



--
This message was sent by Atlassian Jira
(v8.20.1#820001)