You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2020/04/30 07:43:00 UTC
[jira] [Commented] (ARROW-8642) Is there a good way to convert data
types from numpy types to pyarrow DataType?
[ https://issues.apache.org/jira/browse/ARROW-8642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17096272#comment-17096272 ]
Joris Van den Bossche commented on ARROW-8642:
----------------------------------------------
There is a {{from_numpy_dtype}} function for this:
{code}
In [42]: pa.from_numpy_dtype(np.dtype("int8"))
Out[42]: DataType(int8)
{code}
It's included in the API docs here: https://arrow.apache.org/docs/python/api/datatypes.html
> Is there a good way to convert data types from numpy types to pyarrow DataType?
> -------------------------------------------------------------------------------
>
> Key: ARROW-8642
> URL: https://issues.apache.org/jira/browse/ARROW-8642
> Project: Apache Arrow
> Issue Type: Wish
> Reporter: Anish Biswas
> Priority: Major
>
> Pretty much what the title says. Suppose I have a numpy array and its a numpy.int8 type. How do I convert it to a pyarrow.Datatype intuitively? I thought a Dictionary lookup table might work but perhaps there is some better way?
> Why do I need this? I am trying to make pyarrow arrays with from_buffers(). The first parameter is essentially a pyarrow.Datatype. So that's why. I have validity_bitmaps as a buffer of uint8 and that's why I am using from_buffers() and not pyarrow.array().
--
This message was sent by Atlassian Jira
(v8.3.4#803005)