Skip to content

[Python] Support mask in FixedSizeListArray.from_arrays  #34316

@kylebarron

Description

@kylebarron

Describe the enhancement requested

In ListArray.from_arrays it's possible to pass in a mask array defining which list elements are null. FixedSizeListArray.from_arrays does not currently have a mask parameter, so it appears impossible to create a fixed size list array where some elements are null?

pa.array([1, 2, 3, 4], mask=[False, True, False, False])
# <pyarrow.lib.Int64Array object at 0x126eb29e0>
# [
#   1,
#   null,
#   3,
#   4
# ]
pa.FixedSizeListArray.from_arrays([1, 2, 3, 4], 2)
# <pyarrow.lib.FixedSizeListArray object at 0x127255900>
# [
#   [
#     1,
#     2
#   ],
#   [
#     3,
#     4
#   ]
# ]
pa.FixedSizeListArray.from_arrays([1, 2, 3, 4], 2, mask=[False, True])
# TypeError                                 Traceback (most recent call last)
# /Users/kyle/fused/application/job/job/raster/naip/async_zonal_stats.py in line 1
# ----> 449 pa.FixedSizeListArray.from_arrays([1, 2, 3, 4], 2, mask=[False, True])
#
# File ~/fused/application/job/.venv/lib/python3.11/site-packages/pyarrow/array.pxi:2141, in pyarrow.lib.FixedSizeListArray.from_arrays()
#
# TypeError: from_arrays() got an unexpected keyword argument 'mask'

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions