We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent db12255 commit 7abd759Copy full SHA for 7abd759
pandas/core/generic.py
@@ -842,7 +842,25 @@ def __contains__(self, key):
842
843
@property
844
def empty(self):
845
- """True if NDFrame is entirely empty [no items]"""
+ """True if NDFrame is entirely empty [no items], i.e. all of the axes
846
+ are of length 0.
847
+
848
+ Notes
849
+ -----
850
+ If NDFrame contains only NaNs, it is still not considered empty.
851
852
+ Examples
853
+ --------
854
855
+ >>> # containing only NaNs does not make the df empty
856
+ >>> df = pd.DataFrame({'A' : [np.nan]})
857
+ >>> df.empty
858
+ False
859
+ >>> # if we drop NAs, the axes are now of length 0
860
+ >>> df.dropna().empty
861
+ True
862
863
+ """
864
return not all(len(self._get_axis(a)) > 0 for a in self._AXIS_ORDERS)
865
866
def __nonzero__(self):
0 commit comments