You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Jim Crist (JIRA)" <ji...@apache.org> on 2018/01/25 22:51:00 UTC

[jira] [Commented] (ARROW-1999) [Python] from_numpy_dtype returns wrong types

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

Jim Crist commented on ARROW-1999:
----------------------------------

This looks to be because the cython code is wrapping `NumPyDtypeToArrow`, which expects a dtype object, but the objects being passed in aren't `dtype` objects.

 
{code:java}
In [8]: pa.from_numpy_dtype(np.dtype('U'))  # this is a dtype, works fine
Out[8]: DataType(string)

In [9]: pa.from_numpy_dtype(np.unicode)  # not a dtype
Out[9]: DataType(int8)
{code}
I'd like to take this on. Since the C++ signature is `PyObject`, should the conversion be done there or in the cython code? It's not clear to me the distinction between the cython and c++ python codebases.

> [Python] from_numpy_dtype returns wrong types
> ---------------------------------------------
>
>                 Key: ARROW-1999
>                 URL: https://issues.apache.org/jira/browse/ARROW-1999
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>         Environment: Windows 10 Build 15063.850
> Python: 3.6.3
> Numpy: 1.14.0
>            Reporter: Victor Jimenez
>            Assignee: Phillip Cloud
>            Priority: Major
>             Fix For: 0.9.0
>
>
> The following code shows multiple issues when using {{from_numpy_dtype}}:
> {code}
> import numpy as np
> import pyarrow as pa
> pa.from_numpy_dtype(np.unicode) # returns DataType(bool)
> pa.from_numpy_dtype(np.int)     # returns DataType(bool)
> pa.from_numpy_dtype(np.int64) # Fails with the following message:
> #
> # ArrowNotImplementedError Traceback (most recent call last)
> # <ipython-input-14-ca0855a7dda8> in <module>()
> # ----> 1 pa.from_numpy_dtype(np.int64)
> # 2
> #
> # types.pxi in pyarrow.lib.from_numpy_dtype()
> #
> # error.pxi in pyarrow.lib.check_status()
> #
> # ArrowNotImplementedError: Unsupported numpy type 32760
> {code}
> Additionally, a potentially related issue is also seen when using {{to_pandas_dtype}}:
> {code}
> pa.DataType.to_pandas_dtype(pa.string()) # Returns numpy.object_ 
>                                          # (shouldn't it be numpy.unicode?)
> {code}



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