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

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

wesm commented on a change in pull request #1686: ARROW-2240: [Python] Array 
initialization with leading numpy nan fails with exception
URL: https://github.com/apache/arrow/pull/1686#discussion_r171969572
 
 

 ##########
 File path: cpp/src/arrow/python/builtin_convert.cc
 ##########
 @@ -88,7 +88,7 @@ class ScalarVisitor {
 
   Status Visit(PyObject* obj) {
     ++total_count_;
-    if (obj == Py_None) {
+    if (obj == Py_None || (PyFloat_Check(obj) && 
std::isnan(PyFloat_AsDouble(obj)))) {
 
 Review comment:
   This logic is slightly duplicated with `PyFloat_IsNaN`

----------------------------------------------------------------
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:
us...@infra.apache.org


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