-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add examples and notes to empty documentation #12442
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
Changes from 1 commit
7abd759
f9ef74a
59da0f9
30f09ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -842,7 +842,25 @@ def __contains__(self, key): | |
|
||
@property | ||
def empty(self): | ||
"""True if NDFrame is entirely empty [no items]""" | ||
"""True if NDFrame is entirely empty [no items], i.e. all of the axes | ||
are of length 0. | ||
|
||
Notes | ||
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. this should be below examples. 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. To clarify, do you mean move the entire notes section below examples? 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. I think it is OK to leave it here (Jeff, in the html rendered version, the notes will also be before the examples, irregardless of how the order is here) |
||
----- | ||
If NDFrame contains only NaNs, it is still not considered empty. | ||
|
||
Examples | ||
-------- | ||
|
||
>>> # containing only NaNs does not make the df empty | ||
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. Can you make this a normal sentence (not a comment in the code block), and then leave a blank line between that and the code block on the following lines ? |
||
>>> df = pd.DataFrame({'A' : [np.nan]}) | ||
>>> df.empty | ||
False | ||
>>> # if we drop NAs, the axes are now of length 0 | ||
>>> df.dropna().empty | ||
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. Idem as above about the comment + I would also show the output of the actual empty frame |
||
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. add a |
||
""" | ||
return not all(len(self._get_axis(a)) > 0 for a in self._AXIS_ORDERS) | ||
|
||
def __nonzero__(self): | ||
|
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.
any, not all