Skip to content

Commit e27db07

Browse files
authored
Doc: Clean obj.empty docs to describe Series/DataFrame (#44430)
1 parent d36acbb commit e27db07

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pandas/core/generic.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -2003,15 +2003,15 @@ def __contains__(self, key) -> bool_t:
20032003
@property
20042004
def empty(self) -> bool_t:
20052005
"""
2006-
Indicator whether DataFrame is empty.
2006+
Indicator whether Series/DataFrame is empty.
20072007
2008-
True if DataFrame is entirely empty (no items), meaning any of the
2008+
True if Series/DataFrame is entirely empty (no items), meaning any of the
20092009
axes are of length 0.
20102010
20112011
Returns
20122012
-------
20132013
bool
2014-
If DataFrame is empty, return True, if not return False.
2014+
If Series/DataFrame is empty, return True, if not return False.
20152015
20162016
See Also
20172017
--------
@@ -2021,7 +2021,7 @@ def empty(self) -> bool_t:
20212021
20222022
Notes
20232023
-----
2024-
If DataFrame contains only NaNs, it is still not considered empty. See
2024+
If Series/DataFrame contains only NaNs, it is still not considered empty. See
20252025
the example below.
20262026
20272027
Examples
@@ -2047,6 +2047,16 @@ def empty(self) -> bool_t:
20472047
False
20482048
>>> df.dropna().empty
20492049
True
2050+
2051+
>>> ser_empty = pd.Series({'A' : []})
2052+
>>> ser_empty
2053+
A []
2054+
dtype: object
2055+
>>> ser_empty.empty
2056+
False
2057+
>>> ser_empty = pd.Series()
2058+
>>> ser_empty.empty
2059+
True
20502060
"""
20512061
return any(len(self._get_axis(a)) == 0 for a in self._AXIS_ORDERS)
20522062

0 commit comments

Comments
 (0)