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

ASF GitHub Bot commented on ARROW-2240:
---------------------------------------

pitrou commented on issue #1686: ARROW-2240: [Python] Array initialization with 
leading numpy nan fails with exception
URL: https://github.com/apache/arrow/pull/1686#issuecomment-370345571
 
 
   Is this a real bug at all? A NaN is still a floating-point "number", so it 
sounds reasonable to abort type inference when given both a FP number and a 
Python string...
   
   As a point of comparison, it also fails when you pass an explicit type:
   ```
   >>> pa.array([np.nan, 's'], type=pa.string())
   Traceback (most recent call last):
     File "<ipython-input-18-015a2f2f7924>", line 1, in <module>
       pa.array([np.nan, 's'], type=pa.string())
     File "array.pxi", line 181, in pyarrow.lib.array
     File "array.pxi", line 36, in pyarrow.lib._sequence_to_array
     File "error.pxi", line 77, in pyarrow.lib.check_status
   ArrowInvalid: 
/home/antoine/arrow/cpp/src/arrow/python/builtin_convert.cc:979 code: 
AppendPySequence(seq, size, real_type, builder.get())
   /home/antoine/arrow/cpp/src/arrow/python/builtin_convert.cc:402 code: 
static_cast<Derived*>(this)->AppendSingle(ref.obj())
   Non bytes/unicode value encountered: nan
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [Python] Array initialization with leading numpy nan fails with exception
> -------------------------------------------------------------------------
>
>                 Key: ARROW-2240
>                 URL: https://issues.apache.org/jira/browse/ARROW-2240
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>            Reporter: Florian Jetter
>            Priority: Minor
>              Labels: pull-request-available
>
>  
> Arrow initialization fails for string arrays with leading numpy NAN
> {code:java}
> import pyarrow as pa
> import numpy as np
> pa.array([np.nan, 'str'])
> # Py3: ArrowException: Unknown error: must be real number, not str
> # Py2: ArrowException: Unknown error: a float is required{code}



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

Reply via email to