[ 
https://issues.apache.org/jira/browse/ARROW-2136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16360847#comment-16360847
 ] 

Wes McKinney commented on ARROW-2136:
-------------------------------------

We have not yet implemented handling for non-nullable fields in most of the 
pandas conversions. Probably the simplest thing to do will be to leave the 
current conversion code as is and then raise an exception if a non-nullable 
field turns out to have nulls post-conversion to Arrow

> Non nullable schema ignored
> ---------------------------
>
>                 Key: ARROW-2136
>                 URL: https://issues.apache.org/jira/browse/ARROW-2136
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>            Reporter: Matthew Gilbert
>            Priority: Major
>
> If you provide a schema with {{nullable=False}} but pass a {{DataFrame}} 
> which in fact has nulls it appears the schema is ignored? I would expect an 
> error here.
> {code}
> import pyarrow as pa
> import pandas as pd
> df = pd.DataFrame({"a":[1.2, 2.1, pd.np.NaN]})
> schema = pa.schema([pa.field("a", pa.float64(), nullable=False)])
> table = pa.Table.from_pandas(df, schema=schema)
> table[0]
> <pyarrow.lib.Column object at 0x7f213bf2fb70>
> chunk 0: <pyarrow.lib.DoubleArray object at 0x7f213bf20ea8>
> [
>   1.2,
>   2.1,
>   NA
> ]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to