You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "David Li (Jira)" <ji...@apache.org> on 2021/05/14 20:49:00 UTC
[jira] [Resolved] (ARROW-12677) [Python] Add a mask argument to
pyarrow.StructArray.from_arrays
[ https://issues.apache.org/jira/browse/ARROW-12677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Li resolved ARROW-12677.
------------------------------
Fix Version/s: 5.0.0
Resolution: Fixed
Issue resolved by pull request 10272
[https://github.com/apache/arrow/pull/10272]
> [Python] Add a mask argument to pyarrow.StructArray.from_arrays
> ---------------------------------------------------------------
>
> Key: ARROW-12677
> URL: https://issues.apache.org/jira/browse/ARROW-12677
> Project: Apache Arrow
> Issue Type: Improvement
> Components: Python
> Reporter: &res
> Assignee: Weston Pace
> Priority: Trivial
> Labels: pull-request-available
> Fix For: 5.0.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> The python API for creating StructArray from a list of array doesn't allow to pass a missing value mask.
> At the moment the only way to create a StructArray with missing value is to use `pyarrow.array` and passing a vector of tuple.
> {code:python}
> >>> 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"
> ]
> >>> 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"
> ]
> {code}
> The C++ API allows it, so it should be easy to add.
> see [this so question|https://stackoverflow.com/questions/67417110/]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)