-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Update Series.repeat docstring #20242
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
Conversation
@pedropazzini Can you check the similar PR #19985 to see if there is something in there you can use? (eg explanation for the |
pandas/core/series.py
Outdated
for more information about the `repeats` argument. | ||
Repeat elements of a Series. | ||
|
||
Each element of the Series is repeated 'repeats' times. |
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.
Single backtick for parameters like `repeats`
pandas/core/series.py
Outdated
---------- | ||
repeats : int | ||
The number of repetitions for each element. | ||
*args |
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.
You can remove args and kwargs. The validation function is an implementation detail that users shouldn't have to worry about. repeats
is the only valid argument.
You could mention, perhaps in Notes
that "unlike numpy.repeat
, `axis` is not a valid argument".
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.
Listen to @jorisvandenbossche about args and kwargs, not me :)
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.
After discussion, you can document them like
*args, **kwargs
Additional keywords have no effect but might be accepted for
compatibility with numpy.
pandas/core/series.py
Outdated
-------- | ||
>>> df = pd.DataFrame({'col1' : ['A','B','C'],'col2' : [ 0 , 1 , 2 ]}) | ||
>>> df | ||
col1 col2 |
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.
Spacing looks off. Should move it over a few spaces I think. Double check that this is right.
@pedropazzini Is there a reason that you closed this? |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Please include the output of the validation script below between the "```" ticks:
The errors returned for the script is an error, since t is not ready for **kwargs and *args parameters.