[ 
https://issues.apache.org/jira/browse/ARROW-9997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17368691#comment-17368691
 ] 

Joris Van den Bossche commented on ARROW-9997:
----------------------------------------------

Small correction: you can already get a field by index by passing an integer to 
{{\_\_getitem\_\_}}:

{code}
In [19]: s = pa.scalar([('a', 1), ('b', 2), ('a', 3)], pa.struct([('a', 
'int64'), ('b', 'int64'), ('a', 'int64')]))

In [20]: type(s)
Out[20]: pyarrow.lib.StructScalar

In [21]: s[0]
Out[21]: <pyarrow.Int64Scalar: 1>
{code}

The repr is also failing because that relies on {{as_py}}

> [Python] StructScalar.as_py() fails if the type has duplicate field names
> -------------------------------------------------------------------------
>
>                 Key: ARROW-9997
>                 URL: https://issues.apache.org/jira/browse/ARROW-9997
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Krisztian Szucs
>            Assignee: Krisztian Szucs
>            Priority: Major
>             Fix For: 5.0.0
>
>
> {{StructScalar}} currently extends an abstract Mapping interface. Since the 
> type allows duplicate field names we cannot provide that API.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to