You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2021/02/17 18:27:00 UTC
[jira] [Commented] (ARROW-9451) [Python] Unsigned integer types
will accept string values in pyarrow.array
[ https://issues.apache.org/jira/browse/ARROW-9451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17286059#comment-17286059 ]
Antoine Pitrou commented on ARROW-9451:
---------------------------------------
Sorry for the lack of response. I would expect strings to be rejected here.
> [Python] Unsigned integer types will accept string values in pyarrow.array
> --------------------------------------------------------------------------
>
> Key: ARROW-9451
> URL: https://issues.apache.org/jira/browse/ARROW-9451
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Reporter: Wes McKinney
> Priority: Major
> Fix For: 4.0.0
>
>
> See
> {code}
> In [12]: pa.array(['5'], type='uint32')
> Out[12]:
> <pyarrow.lib.UInt32Array object at 0x7fabbdb1edc8>
> [
> 5
> ]
> {code}
> Also:
> {code}
> In [9]: pa.scalar('5', type='uint8')
> Out[9]: <pyarrow.UInt8Scalar: 5>
> In [10]: pa.scalar('5', type='uint16')
> Out[10]: <pyarrow.UInt16Scalar: 5>
> In [11]: pa.scalar('5', type='uint32')
> Out[11]: <pyarrow.UInt32Scalar: 5>
> {code}
> But:
> {code}
> In [13]: pa.array(['5'], type='int32')
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
> <ipython-input-13-48092f69d948> in <module>
> ----> 1 pa.array(['5'], type='int32')
> ~/code/arrow/python/pyarrow/array.pxi in pyarrow.lib.array()
> 267 else:
> 268 # ConvertPySequence does strict conversion if type is explicitly passed
> --> 269 return _sequence_to_array(obj, mask, size, type, pool, c_from_pandas)
> 270
> 271
> ~/code/arrow/python/pyarrow/array.pxi in pyarrow.lib._sequence_to_array()
> 36
> 37 with nogil:
> ---> 38 check_status(ConvertPySequence(sequence, mask, options, &out))
> 39
> 40 if out.get().num_chunks() == 1:
> TypeError: an integer is required (got type str)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)