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

Adds choose method to dask.array.Array #2584

Merged
merged 4 commits into from Aug 5, 2017

Conversation

jrbourbeau
Copy link
Member

Fixes issue #2569. As mentioned in the issue, a dask.array.choose function already exists. This PR copies the dask.array.choose functionality into a choose method for dask.array.Array objects.

@@ -1307,6 +1307,10 @@ def ravel(self):

flatten = ravel

@wraps(np.choose)
def choose(self, choices):
return elemwise(variadic_choose, self, *choices)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense for this to just call the function implementation or vice versa?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point! It probably makes more sense to just implement choose on a dask Array once. I'll change the PR to have the choose function simply call the choose method on an input dask array.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal preference, but I'd rather have the method call the function (smaller diff too). Not a big deal though, up to you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jcrist, yeah I can switch it so that the method calls the function. I don't have a strong preference either way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for completeness, the argument for the function calling the method would be to handle inheritance from Dask Array. That said, I have no strong preferences here either and it can always be changed if there is a need.

@jakirkham
Copy link
Member

One of the builds failed and it appears to be spurious, would it be possible to get a restart?

@jcrist jcrist merged commit 6f8ec47 into dask:master Aug 5, 2017
@jcrist
Copy link
Member

jcrist commented Aug 5, 2017

Thanks @jrbourbeau!

@jrbourbeau jrbourbeau deleted the add_array_choose_method branch August 5, 2017 13:27
@sinhrks sinhrks added this to the 0.15.2 milestone Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants