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

Antoine Pitrou resolved ARROW-7218.
-----------------------------------
    Resolution: Fixed

Issue resolved by pull request 7866
[https://github.com/apache/arrow/pull/7866]

> [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: Improvement
>          Components: Python
>            Reporter: Joris Van den Bossche
>            Assignee: Krisztian Szucs
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 2.0.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to