Repository navigation
BUG: random: Use correct length when axis is given to shuffle. - #14662
Merged
Merged
Conversation
When an axis argument was given, shuffle was using the original length of the array instead of the length of the given axis. This meant that, for example, if an array with shape (2, 10) was shuffled with axis=1, only the first two columns were shuffled.
This was referenced Oct 8, 2019
eric-wieser
reviewed
Oct 8, 2019
| def shuffle(self, object x, axis=0): | ||
| """ | ||
| shuffle(x) | ||
| shuffle(x, axis=0) |
Member
There was a problem hiding this comment.
I'm surprised these are needed at all - does cython not work with inspect.signature?
Member
Author
There was a problem hiding this comment.
I haven't looked into it. I only noticed that the axis was missing when I used rng.shuffle? in ipython. It shows only the docstring, with no separate line for the signature.
Member
There was a problem hiding this comment.
Perhaps I'll take a look at this at some point
eric-wieser
approved these changes
Oct 8, 2019
seberg
approved these changes
Oct 9, 2019
seberg
left a comment
Member
There was a problem hiding this comment.
Feel free and just merge yourself Warren, I was thinking if we should reorganize the n definition for a second, but I guess it does not really matter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an axis argument was given, shuffle was using the original length of
the array instead of the length of the given axis. This meant that, for
example, if an array with shape (2, 10) was shuffled with axis=1, only the
first two columns were shuffled.