You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "&res (Jira)" <ji...@apache.org> on 2022/11/07 11:46:00 UTC
[jira] [Updated] (ARROW-18257) [Python] array of time64 type changes from Time64Type to DataType
[ https://issues.apache.org/jira/browse/ARROW-18257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
&res updated ARROW-18257:
-------------------------
Component/s: Python
> [Python] array of time64 type changes from Time64Type to DataType
> -----------------------------------------------------------------
>
> Key: ARROW-18257
> URL: https://issues.apache.org/jira/browse/ARROW-18257
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 10.0.0
> Environment: python 3.9
> pyarrow 10.0.0
> No pandas installed
> Reporter: &res
> Priority: Minor
>
> When creating an array of time64 elements, the array type information is changed from Time64Type to DataType.
> While it's not an issue as such, given it still looks like an array of time64, I can't access special attributes of the Time64Type (for example unit)
>
> {code:java}
> dtype = pa.time64("ns")
> time_array = pa.array(
> [
> 1,
> 2,
> 3
> ],
> dtype
> )
> assert pa.types.is_time64(time_array.type) is True
> assert isinstance(dtype, pa.Time64Type) is True
> assert isinstance(time_array.type, pa.Time64Type) is False # Wrong
> assert isinstance(time_array.type, pa.DataType) is True # Wrong
> assert dtype == time_array.type
> assert dtype.unit == "ns"
> with pytest.raises(AttributeError, match=r"'pyarrow.lib.DataType' object has no attribute 'unit'"):
> # Should be able to access unit:
> time_array.type.unit{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)