You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Antoine Pitrou (JIRA)" <ji...@apache.org> on 2018/02/12 15:56:00 UTC

[jira] [Commented] (ARROW-2008) [Python] Type inference for int32 NumPy arrays (expecting list) returns int64 and then conversion fails

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

Antoine Pitrou commented on ARROW-2008:
---------------------------------------

This seems to work here:
{code:python}
>>> a = np.zeros(1, dtype=np.object)
>>> a[0] = np.int16([4,5,6])
>>> pa.array(a)
<pyarrow.lib.ListArray object at 0x7f72e9141f48>
[
  [4,
   5,
   6]
]
>>> pa.array(a).type
ListType(list<item: int16>)
{code}
and also:
{code:python}
>>> pa.array(pd.Series(a))
<pyarrow.lib.ListArray object at 0x7f72e9018048>
[
  [4,
   5,
   6]
]
>>> pa.array(pd.Series(a)).type
ListType(list<item: int16>)
{code}

> [Python] Type inference for int32 NumPy arrays (expecting list<int32>) returns int64 and then conversion fails
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-2008
>                 URL: https://issues.apache.org/jira/browse/ARROW-2008
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Wes McKinney
>            Priority: Major
>             Fix For: 0.9.0
>
>
> See report in [https://github.com/apache/arrow/issues/1430]
> {{arrow::py::InferArrowType}} is called, when traverses the array as though it were any other Python sequence, and NumPy int32 scalars are not recognized as such



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)