You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Nic Crane (Jira)" <ji...@apache.org> on 2021/06/01 08:46:00 UTC

[jira] [Updated] (ARROW-12913) [Python] Non-nullable schema fields not checked in Table.from_pydict

     [ https://issues.apache.org/jira/browse/ARROW-12913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nic Crane updated ARROW-12913:
------------------------------
    Summary: [Python] Non-nullable schema fields not checked in Table.from_pydict  (was: Non-nullable schema fields not checked in Table.from_pydict)

> [Python] Non-nullable schema fields not checked in Table.from_pydict
> --------------------------------------------------------------------
>
>                 Key: ARROW-12913
>                 URL: https://issues.apache.org/jira/browse/ARROW-12913
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 4.0.1
>            Reporter: Laurent Kadian
>            Priority: Major
>
> This issue is similar to ARROW-2136.
> If you provide a schema with nullable=False to Table.from_pydict and the data you provide has nulls, no exception is raised and the table is constructed successfully.
> {noformat}
> >>> import pyarrow as pa
> >>> pydict = dict(a=[1.2, 2.1, None])
> >>> schema = pa.schema([pa.field("a", pa.float64(), nullable=False)])
> >>> table = pa.Table.from_pydict(pydict, schema=schema)
> >>> 
> >>> table[0]
> <pyarrow.lib.ChunkedArray object at 0x7f367f499ea0>
> [
>   [
>     1.2,
>     2.1,
>     null
>   ]
> ]
> >>> table.schema
> a: double not null
> >>> 
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)