-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: Docstring pandas index all any #20168
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
Merged
TomAugspurger
merged 7 commits into
pandas-dev:master
from
alinde1:docstring_pandasIndex_all_any
Mar 13, 2018
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2bb43b8
DOC: Improved the docstring of pandasIndex.all and pandasIndex.any.
70695c2
DOC: Improved docstring of pandas.Index.all and pandas.Index.any
0adc9d3
DOC: Improved docstring
6eefa7b
Added space after commas
65ba74a
Merge remote-tracking branch 'upstream/master' into docstring_pandasI…
231fdcc
Added requested changes.
23c2c3d
Fixup [ci skip]
TomAugspurger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4290,20 +4290,67 @@ def _add_logical_methods(cls): | |
""" add in logical methods """ | ||
|
||
_doc = """ | ||
|
||
%(desc)s | ||
|
||
Parameters | ||
---------- | ||
All arguments to numpy.%(outname)s are accepted. | ||
*args | ||
These parameters will be passed to numpy.%(outname)s. | ||
**kwargs | ||
These parameters will be passed to numpy.%(outname)s. | ||
|
||
Returns | ||
------- | ||
%(outname)s : bool or array_like (if axis is specified) | ||
A single element array_like may be converted to bool.""" | ||
|
||
_index_shared_docs['index_all'] = """ | ||
|
||
See Also | ||
-------- | ||
pandas.Index.any : Return whether any element is True. | ||
|
||
Notes | ||
----- | ||
Not a Number (NaN), positive infinity and negative infinity | ||
evaluate to True because these are not equal to zero. | ||
|
||
Examples | ||
-------- | ||
>>> index = pd.Index([1, 2, 3]) | ||
>>> index.all() | ||
True | ||
|
||
>>> index = pd.Index([0, 1, 2]) | ||
>>> index.all() | ||
False | ||
""" | ||
|
||
_index_shared_docs['index_any'] = """ | ||
|
||
See Also | ||
-------- | ||
pandas.Index.all : Return whether all elements are True. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pandas.Series.all |
||
|
||
Notes | ||
----- | ||
Not a Number (NaN), positive infinity and negative infinity | ||
evaluate to True because these are not equal to zero. | ||
|
||
Examples | ||
-------- | ||
>>> index = pd.Index([0, 1, 2]) | ||
>>> index.any() | ||
True | ||
|
||
>>> index = pd.Index([0, 0, 0]) | ||
>>> index.any() | ||
False | ||
""" | ||
|
||
def _make_logical_function(name, desc, f): | ||
@Substitution(outname=name, desc=desc) | ||
@Appender(_index_shared_docs['index_' + name]) | ||
@Appender(_doc) | ||
def logical_func(self, *args, **kwargs): | ||
result = f(self.values) | ||
|
@@ -4318,10 +4365,10 @@ def logical_func(self, *args, **kwargs): | |
return logical_func | ||
|
||
cls.all = _make_logical_function('all', 'Return whether all elements ' | ||
'are True', | ||
'are True.', | ||
np.all) | ||
cls.any = _make_logical_function('any', | ||
'Return whether any element is True', | ||
'Return whether any element is True.', | ||
np.any) | ||
|
||
@classmethod | ||
|
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.
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.
pandas.Series.any as well