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

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

Joris Van den Bossche created ARROW-7218:
--------------------------------------------

             Summary: [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


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)