Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where #75

Closed
jpivarski opened this issue Jan 14, 2020 · 2 comments
Closed

where #75

jpivarski opened this issue Jan 14, 2020 · 2 comments
Assignees
Labels
feature New feature or request

Comments

@jpivarski
Copy link
Member

numpy.where takes three arguments (ignore the single-argument version: it's equivalent to nonzero and we can do that other ways):

  • condition, a boolean array
  • x, any array
  • y, any array

and returns a single array with x values if condition is true and y values if condition is false.

We can do this in Awkward even if x and y are not the same type; ak.where would return a UnionArray (my issue #54).

If x and y do have the same type, we can return something simpler. Actually, we can do well by implementing the general case with UnionArray first, then add special cases like "both are NumpyArrays of the same format" or "both have ListType with compatible content," one by one as needed.

@jpivarski jpivarski added the feature New feature or request label Jan 14, 2020
@jpivarski
Copy link
Member Author

This was a frequently requested feature (see old issue, also frequently requested in person).

@jpivarski jpivarski mentioned this issue Jan 14, 2020
@jpivarski
Copy link
Member Author

Fixed in PR #89.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants