[
https://issues.apache.org/jira/browse/ARROW-9407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17155981#comment-17155981
]
Joris Van den Bossche commented on ARROW-9407:
----------------------------------------------
[~wesm] recently added support for pd.NA (ARROW-842,
https://github.com/apache/arrow/pull/7537), but apparently not yet for all
cases.
First, {{from_pandas=True}} needs to be specified:
{code}
In [22]: pa.array(["A", pd.NA], from_pandas=True)
Out[22]:
<pyarrow.lib.StringArray object at 0x7ff2cf60fc48>
[
"A",
null
]
{code}
and thus doing like the above with a first typed element works. With pd.NA
first it still doesn't work, so maybe that it is not yet correctly recognized
as null where there is not yet an inferred type.
> [Python] Accept pd.NA as missing value in array constructor
> -----------------------------------------------------------
>
> Key: ARROW-9407
> URL: https://issues.apache.org/jira/browse/ARROW-9407
> Project: Apache Arrow
> Issue Type: New Feature
> Components: Python
> Reporter: Uwe Korn
> Priority: Major
> Fix For: 2.0.0
>
>
> Currently we don't support using {{pandas.NA}} at all:
> {code}
> In [1]: import pyarrow as pa
> In [2]: import pandas as pd
> In [3]: pa.array([pd.NA, "A"])
> ---------------------------------------------------------------------------
> ArrowInvalid Traceback (most recent call last)
> <ipython-input-3-77e774fa8521> in <module>
> ----> 1 pa.array([pd.NA, "A"])
> ~/miniconda3/envs/fletcher/lib/python3.8/site-packages/pyarrow/array.pxi in
> pyarrow.lib.array()
> ~/miniconda3/envs/fletcher/lib/python3.8/site-packages/pyarrow/array.pxi in
> pyarrow.lib._sequence_to_array()
> ~/miniconda3/envs/fletcher/lib/python3.8/site-packages/pyarrow/error.pxi in
> pyarrow.lib.check_status()
> ArrowInvalid: Could not convert <NA> with type NAType: did not recognize
> Python value type when inferring an Arrow data type
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)