-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Improve docstring of Index.delete #32015
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
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.
Looks good, just few minor comments
pandas/core/indexes/base.py
Outdated
@@ -5135,9 +5135,30 @@ def delete(self, loc): | |||
""" | |||
Make new Index with passed location(-s) deleted. | |||
|
|||
Use array of integer as loc parameter to delete multiple locations. |
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.
Can you explain this in the parameter description please
pandas/core/indexes/base.py
Outdated
|
||
Parameters | ||
---------- | ||
loc : int |
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 or list of int
pandas/core/indexes/base.py
Outdated
Examples | ||
-------- | ||
>>> idx = pd.Index(['a', 'b', 'c']) | ||
>>> idx.delete(1) # Deleting 'b' |
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 think you can remove the comment, the example is good enough to be clear that we're deleting b
Hello @andhikayusup! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-02-15 12:19:52 UTC |
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.
Just one comment in a sentence that I think could be improved, but looks good to me.
pandas/core/indexes/base.py
Outdated
---------- | ||
loc : int or list of int | ||
Location of item(-s) which will be deleted. | ||
Use list of integer as loc parameter to delete multiple locations. |
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.
What do you think about the next?
Use a list of locations to delete more than one value at the same time
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.
looks good
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.
Thanks!
Thanks @andhikayusup |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Output from validate_docstrings.py
################################################################################
####################### Docstring (pandas.Index.delete) #######################
################################################################################
Make new Index with passed location(-s) deleted.
Use array of integer as loc parameter to delete multiple locations.
Parameters
loc : int
Location of item(-s) which will be deleted.
Returns
Index
New Index with passed location(-s) deleted.
See Also
numpy.delete : Delete any rows and column from NumPy array (ndarray).
Examples
################################################################################
################################## Validation ##################################
################################################################################