Skip to content

[Python] Construct nested MapArray from nested sequence of dicts #33928

@HyukjinKwon

Description

@HyukjinKwon

Describe the bug, including details regarding any error messages, version, and platform.

#14547 fixed:

import pyarrow as pa
pa.array([{'a': 1, 'b': 2}, {'c': 3}], pa.map_(pa.string(), pa.int64()))

to work. However, it missed nested case. For example the code below:

import pyarrow as pa
pa.array([[{'a': 1, 'b': 2}, {'c': 3}]], pa.list_(pa.map_(pa.string(), pa.int64())))

It currently fails with the error below:

pyarrow.lib.ArrowTypeError: Could not convert {'a': 1, 'b': 2} with type dict: was not a sequence or recognized null for conversion to list type

See also #33053 and #14116

Component(s)

Python

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions