[
https://issues.apache.org/jira/browse/ARROW-17832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17608866#comment-17608866
]
Aldrin Montana commented on ARROW-17832:
----------------------------------------
at a first glance, it seems like
[pyarrow.array()|https://github.com/apache/arrow/blob/f0303652b4934a9f767dca88268016c69375687d/python/pyarrow/array.pxi#L117]
needs another condition ([like
_is_array_like|https://github.com/apache/arrow/blob/f0303652b4934a9f767dca88268016c69375687d/python/pyarrow/array.pxi#L232])
that checks for a mapping type and then converts the mapping type into an
appropriate array?
and maybe [code for converting pandas categorical
types|https://github.com/apache/arrow/blob/f0303652b4934a9f767dca88268016c69375687d/python/pyarrow/array.pxi#L264]
can be reused?
> [Python] Construct MapArray from sequence of dicts (instead of list of tuples)
> ------------------------------------------------------------------------------
>
> Key: ARROW-17832
> URL: https://issues.apache.org/jira/browse/ARROW-17832
> Project: Apache Arrow
> Issue Type: Improvement
> Components: Python
> Reporter: Joris Van den Bossche
> Priority: Major
> Labels: python-conversion
>
> From https://github.com/apache/arrow/issues/14116
> Creating a MapArray from a python sequence currently requires lists of tuples
> as values:
> {code}
> arr = pa.array([[('a', 1), ('b', 2)], [('c', 3)]], pa.map_(pa.string(),
> pa.int64()))
> {code}
> While I think it makes sense that the following could also work (using dicts
> instead):
> {code}
> arr = pa.array([{'a': 1, 'b': 2}, {'c': 3}], pa.map_(pa.string(), pa.int64()))
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)