You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Taras Kuzyo (Jira)" <ji...@apache.org> on 2021/04/14 18:57:00 UTC
[jira] [Created] (ARROW-12387) [C++][Python] cannot cast float64
array to int64
Taras Kuzyo created ARROW-12387:
-----------------------------------
Summary: [C++][Python] cannot cast float64 array to int64
Key: ARROW-12387
URL: https://issues.apache.org/jira/browse/ARROW-12387
Project: Apache Arrow
Issue Type: Improvement
Components: C++, Python
Affects Versions: 3.0.0
Reporter: Taras Kuzyo
{code:java}
>>> arr = [992133801741256, 0.993103448275862]
>>> a = pa.scalar(arr[0], pa.float64())
>>> pc.multiply(a, 1e8).cast(pa.int64())
<pyarrow.Int64Scalar: 99213380>
>>> b = pa.array(arr, pa.float64())
>>> pc.multiply(b, 1e8).cast(pa.int64())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyarrow/array.pxi", line 810, in pyarrow.lib.Array.cast
File "/usr/local/lib/python3.6/dist-packages/pyarrow/compute.py", line 281, in cast
return call_function("cast", [arr], options)
File "pyarrow/_compute.pyx", line 465, in pyarrow._compute.call_function
File "pyarrow/_compute.pyx", line 294, in pyarrow._compute.Function.call
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Float value 9.92134e+07 was truncated converting toint64
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)