&res created ARROW-18264:
----------------------------

             Summary: [Python] Add Time64Scalar.value field
                 Key: ARROW-18264
                 URL: https://issues.apache.org/jira/browse/ARROW-18264
             Project: Apache Arrow
          Issue Type: Improvement
         Environment: pyarrow==10.0.0
No pandas installed
            Reporter: &res


At the moment, when pandas is not installed, it is not possible to access the 
underlying value for a Time64Scalar of "ns" precision without casting it to 
int64.
{code:java}
time_ns = pa.array([1, 2, 3],pa.time64("ns"))
scalar = time_ns[0]
scalar.as_py() {code}
Raises:
{code:java}
time_ns = pa.array([1, 2, 3],pa.time64("ns"))
scalar = time_ns[0]
scalar.as_py() {code}
The workaround is to do:
{code:java}
scalar.cast(pa.int64()).as_py() {code}
It'd be good if a value field was added to Time64Scalar, just like the 
TimestampScalar
{code:java}
timestamp_ns = pa.array([1, 2, 3],pa.timestamp("ns", "UTC"))
scalar = timestamp_ns[0]
scalar.value {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to