I'm trying to create a pyarrow.StructArray
with missing values.
I works fine when I use pyarrow.array
passing tuples representing my records:
>>> pyarrow.array(
[
None,
(1, "foo"),
],
type=pyarrow.struct(
[pyarrow.field('col1', pyarrow.int64()), pyarrow.field("col2", pyarrow.string())]
)
)
-- is_valid:
[
false,
true
]
-- child 0 type: int64
[
0,
1
]
-- child 1 type: string
[
"",
"foo"
]
But I want to use the StructArray.from_arrays
and as far as I can tell there's no way to provide a mask for missing values:
pyarrow.StructArray.from_arrays(
[
[None, 1],
[None, "foo"]
],
fields=[pyarrow.field('col1', pyarrow.int64()), pyarrow.field("col2", pyarrow.string())]
)
-- is_valid: all not null
-- child 0 type: int64
[
null,
1
]
-- child 1 type: string
[
null,
"foo"
]
Is there a way to create a StructArray, from array, specifiying a mask of missing values? Or would there be a way to apply the mask later?