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

Joris Van den Bossche updated ARROW-9817:
-----------------------------------------
    Labels: python-conversion  (was: )

> [Python] pa.array raises for mixed scalar types (float16 + int)
> ---------------------------------------------------------------
>
>                 Key: ARROW-9817
>                 URL: https://issues.apache.org/jira/browse/ARROW-9817
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 1.0.0
>            Reporter: Andrew Wieteska
>            Priority: Major
>              Labels: python-conversion
>
> pa.array raises with mixed scalars for np.float16 and a numpy int: 
> {code:java}
> In [1]: import numpy as np 
>  ...: import pyarrow as pa 
>  ...: pa.array([np.float16(1.5), np.int64(5)]) 
> ---------------------------------------------------------------------------
> ArrowInvalid Traceback (most recent call last)
> <ipython-input-2-b1e9d890f325> in <module>
>  1 import numpy as np
>  2 import pyarrow as pa
> ----> 3 pa.array([np.float16(1.5), np.int64(5)])
> ~/git_repo/arrow/python/pyarrow/array.pxi in pyarrow.lib.array()
>  269 else:
>  270 # ConvertPySequence does strict conversion if type is explicitly passed
> --> 271 return _sequence_to_array(obj, mask, size, type, pool, c_from_pandas)
>  272 
>  273
> ~/git_repo/arrow/python/pyarrow/array.pxi in pyarrow.lib._sequence_to_array()
>  38 
>  39 with nogil:
> ---> 40 check_status(ConvertPySequence(sequence, mask, options, &out))
>  41 
>  42 if out.get().num_chunks() == 1:
> ~/git_repo/arrow/python/pyarrow/error.pxi in pyarrow.lib.check_status()
>  82 
>  83 if status.IsInvalid():
> ---> 84 raise ArrowInvalid(message)
>  85 elif status.IsIOError():
>  86 # Note: OSError constructor is
> ArrowInvalid: Cannot mix NumPy dtypes float16 and int64 
> {code}
> On master I get the same behaviour with all numpy ints (signed and unsigned)



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

Reply via email to