From 0c0cfbcab9d2d3802a40239a12b5e2c90435a940 Mon Sep 17 00:00:00 2001 From: Jeffrey Tratner Date: Sun, 28 Jul 2013 00:07:39 -0400 Subject: [PATCH] CLN: Add __bool__ alias for __nonzero__ Python3 uses __bool__, not __nonzero__ --- pandas/core/generic.py | 3 +++ pandas/core/internals.py | 3 +++ 2 files changed, 6 insertions(+) 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)