[
https://issues.apache.org/jira/browse/ARROW-17134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17569124#comment-17569124
]
Matthew Roeschke commented on ARROW-17134:
------------------------------------------
Ah okay that makes sense. When I read len(replacements) == number of true
values in the mask, for some reason I thought "len(replacements)" meant the
values could still be corresponding to the mask.
> We should maybe consider raising an error if the {{replacements}} are too
> long?
That would be helpful, or maybe an example in the docstring could help clarify
that point. Fine either way
> [C++(?)/Python] pyarrow.compute.replace_with_mask does not replace null when
> providing an array mask
> ----------------------------------------------------------------------------------------------------
>
> Key: ARROW-17134
> URL: https://issues.apache.org/jira/browse/ARROW-17134
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++, Python
> Affects Versions: 8.0.0
> Reporter: Matthew Roeschke
> Priority: Major
>
>
> {code:java}
> In [1]: import pyarrow as pa
> In [2]: arr1 = pa.array([1, 0, 1, None, None])
> In [3]: arr2 = pa.array([None, None, 1, 0, 1])
> In [4]: pa.compute.replace_with_mask(arr1, [False, False, False, True, True],
> arr2)
> Out[4]:
> <pyarrow.lib.Int64Array object at 0x118a3e320>
> [
> 1,
> 0,
> 1,
> null, # I would expect 0
> null # I would expect 1
> ]
> In [5]: pa.__version__
> Out[5]: '8.0.0'{code}
>
> I have noticed this behavior occur with the integer, floating, bool, temporal
> types
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)