[
https://issues.apache.org/jira/browse/ARROW-9431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17352717#comment-17352717
]
Joris Van den Bossche commented on ARROW-9431:
----------------------------------------------
It's "another ternary kernel" in the sense that it accepts three arguments, but
it's quite different from "if-else" in that it is not a scalar kernel like
"if-else" is (for "if-else" all inputs are of the same length (or scalars
broadcasted), end then the operation is basically element-wise, while for this
"setitem" that is not the case).
[~niranda] to use your pseudo-code, the expected behaviour looks like:
{code}
def replace_by_index(to_replace: Array, arr1: Array, arr2: Array) -> Array:
out = arr1 # copy array
for idx, val in zip(to_replace, arr2):
out[idx] = val
return out
{code}
so where {{to_replace}} and {{arr2}} have the same length, but are not of the
same length as {{arr1}}.
> [C++/Python] Kernel for SetItem(IntegerArray, values)
> -----------------------------------------------------
>
> Key: ARROW-9431
> URL: https://issues.apache.org/jira/browse/ARROW-9431
> Project: Apache Arrow
> Issue Type: New Feature
> Components: C++, Python
> Affects Versions: 2.0.0
> Reporter: Uwe Korn
> Priority: Major
>
> We should have a kernel that allows overriding the values of an array using
> an integer array as the indexer and a scalar or array of equal length as the
> values.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)