[
https://issues.apache.org/jira/browse/ARROW-18257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17630252#comment-17630252
]
Joris Van den Bossche commented on ARROW-18257:
-----------------------------------------------
Yes, thanks for the report!
This case seems to be missing here:
https://github.com/apache/arrow/blob/72d098b6642424696a3cab34b952196336b28a9a/python/pyarrow/public-api.pxi#L74-L121
(and taking a further look, also Time32Type is missing, but those two seem to
be the only ones with a custom DataType subclass that are missing)
A fix would certainly be welcome if you would be interested!
> [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)