[
https://issues.apache.org/jira/browse/ARROW-9451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated ARROW-9451:
----------------------------------
Labels: pull-request-available (was: )
> [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
> Assignee: Antoine Pitrou
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.0.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)