diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 0cf9a066e11bd..d7fc4ce21ca87 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -651,6 +651,9 @@ def empty(self): def __nonzero__(self): return not self.empty + # Python 3 compat + __bool__ = __nonzero__ + @property def ndim(self): return self._data.ndim diff --git a/pandas/core/internals.py b/pandas/core/internals.py index e2b3131fac9ce..21cfa8658b03c 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -1016,6 +1016,9 @@ def make_empty(self): def __nonzero__(self): return True + # Python3 compat + __bool__ = __nonzero__ + @property def ndim(self): return len(self.axes)