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

Niranda Perera commented on ARROW-14946:
----------------------------------------

[~jorisvandenbossche] actually my initial use case was to search indices of a 
given array of values. Ex:
{code:java}
indices = find_indices(values, [1, 2, 1]) #  expected = [0, 5, 1, 2, 0, 5] 
{code}
But it looked a like a niche use case.

IINM [~amol-] also mentioned about returning a boolean array matching a given 
value, which could in-turn be used for a filter function. In that case, we 
could relax this to a scalar kernel as well. Personally, I think that would be 
an overkill.

> [C++][Python] An operator for finding indices of a value 
> ---------------------------------------------------------
>
>                 Key: ARROW-14946
>                 URL: https://issues.apache.org/jira/browse/ARROW-14946
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++, Python
>            Reporter: Niranda Perera
>            Priority: Major
>
> As discussed in this mail thread [1], it would be nice to have a search 
> operator returning the indices of a Value. 
> ex:
> {code:java}
> values = pa.array([1, 2, 2, 3, 4, 1])
> indices = find_indices(values, 1) #  expected = [0, 5]{code}
> currently there is an option to get the "first index" of a value using 
> aggregates.index method. This would be a binary vector kernel IMO. 
> This is somewhat similar to `numpy.where` [2] but without a `y` input. 
>  
> [1] [https://lists.apache.org/thread/o8d4m905fxswcg0qjjx7gj3ql2d582k4]
> [2] https://numpy.org/doc/stable/reference/generated/numpy.where.html



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

Reply via email to