-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
DOC: Wrong return type of np.random.choice and wrong variable name in parameter description. #8962
Conversation
numpy/random/mtrand/mtrand.pyx
Outdated
@@ -1040,7 +1040,7 @@ cdef class RandomState: | |||
|
|||
Returns | |||
-------- | |||
samples : 1-D ndarray, shape (size,) | |||
samples : int or ndarray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int isn't really correct here - it's either an arbitrary scalar (size == None
), or an ndarray
numpy/random/mtrand/mtrand.pyx
Outdated
@@ -1026,7 +1026,7 @@ cdef class RandomState: | |||
----------- | |||
a : 1-D array-like or int | |||
If an ndarray, a random sample is generated from its elements. | |||
If an int, the random sample is generated as if a was np.arange(n) | |||
If an int, the random sample is generated as if a was np.arange(a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"As if a
were np.arange(a)
". Backticks might be nice here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I omitted adding backticks because most of random
documentation does not include them. And it's kind of nicer to read without code-formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that at least np.arange
should be backticked, but I don't care too much
in parameter description. [ci skip]
Is there something that needs changing or is it just waiting for another review? |
Thanks Michael! |
This fixes some minor documentation issues in
np.random.choice
:a
and notn
as indicated by thenp.arange(n)
comparison.