You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2020/04/27 02:09:00 UTC

[jira] [Updated] (ARROW-7218) [Python] Conversion from boolean numpy scalars not working

     [ https://issues.apache.org/jira/browse/ARROW-7218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes McKinney updated ARROW-7218:
--------------------------------
    Fix Version/s: 1.0.0

> [Python] Conversion from boolean numpy scalars not working
> ----------------------------------------------------------
>
>                 Key: ARROW-7218
>                 URL: https://issues.apache.org/jira/browse/ARROW-7218
>             Project: Apache Arrow
>          Issue Type: Test
>          Components: Python
>            Reporter: Joris Van den Bossche
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> In general, we are fine to accept a list of numpy scalars:
> {code}
> In [12]: type(list(np.array([1, 2]))[0])                                                                                                                                                                           
> Out[12]: numpy.int64
> In [13]: pa.array(list(np.array([1, 2])))                                                                                                                                                                          
> Out[13]: 
> <pyarrow.lib.Int64Array object at 0x7f51a493e2e8>
> [
>   1,
>   2
> ]
> {code}
> But for booleans, this doesn't work:
> {code}
> In [14]: pa.array(list(np.array([True, False])))                                                                                                                                                                   
> ---------------------------------------------------------------------------
> ArrowInvalid                              Traceback (most recent call last)
> <ipython-input-14-0d82cdce82e8> in <module>
> ----> 1 pa.array(list(np.array([True, False])))
> ~/scipy/repos/arrow/python/pyarrow/array.pxi in pyarrow.lib.array()
> ~/scipy/repos/arrow/python/pyarrow/array.pxi in pyarrow.lib._sequence_to_array()
> ~/scipy/repos/arrow/python/pyarrow/array.pxi in pyarrow.lib._ndarray_to_array()
> ArrowInvalid: Could not convert True with type numpy.bool_: tried to convert to boolean
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)