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 2022/03/08 14:05:00 UTC

[jira] [Closed] (ARROW-15853) [Python][Docs] Describe behavior of pyarrow.array()

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

David Li closed ARROW-15853.
----------------------------
    Resolution: Duplicate

Ah, thanks Joris!

> [Python][Docs] Describe behavior of pyarrow.array(<mutable zero-copy source>)
> -----------------------------------------------------------------------------
>
>                 Key: ARROW-15853
>                 URL: https://issues.apache.org/jira/browse/ARROW-15853
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Documentation, Python
>            Reporter: David Li
>            Priority: Major
>
> {noformat}
> Python 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:25:18) [GCC 9.4.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import numpy as np
> >>> import pyarrow as pa
> >>> ndarr = np.array(range(10))
> >>> arr = pa.array(ndarr)
> >>> arr
> <pyarrow.lib.Int64Array object at 0x7efdf7974100>
> [
>   0,
>   1,
>   2,
>   3,
>   4,
>   5,
>   6,
>   7,
>   8,
>   9
> ]
> >>> ndarr[0] = 10
> >>> arr
> <pyarrow.lib.Int64Array object at 0x7efdf7974100>
> [
>   10,
>   1,
>   2,
>   3,
>   4,
>   5,
>   6,
>   7,
>   8,
>   9
> ]
> {noformat}
> While this behavior makes perfect sense with some consideration, it may surprise people. We should document which sources can be zero-copied, and note that in these cases, modifications to the underlying array will affect the PyArrow array (even though this is normally not the case).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)