From f7cc79c23a58ed4de9381257d85be62d39a8ada5 Mon Sep 17 00:00:00 2001 From: Terji Petersen Date: Thu, 20 Apr 2023 15:37:15 +0100 Subject: [PATCH] CLN/depr: NDFrame.bool --- pandas/core/generic.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index bf8cf831b942a..d3e9ca327aa16 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -1473,6 +1473,10 @@ def bool(self) -> bool_t: """ Return the bool of a single element Series or DataFrame. + .. deprecated:: 2.1.0 + + bool is deprecated and will be removed in future version of pandas + This must be a boolean scalar value, either True or False. It will raise a ValueError if the Series or DataFrame does not have exactly 1 element, or that element is not boolean (integer values 0 and 1 will also raise an exception). @@ -1492,14 +1496,14 @@ def bool(self) -> bool_t: -------- The method will only work for single element objects with a boolean value: - >>> pd.Series([True]).bool() + >>> pd.Series([True]).bool() # doctest: +SKIP True - >>> pd.Series([False]).bool() + >>> pd.Series([False]).bool() # doctest: +SKIP False - >>> pd.DataFrame({'col': [True]}).bool() + >>> pd.DataFrame({'col': [True]}).bool() # doctest: +SKIP True - >>> pd.DataFrame({'col': [False]}).bool() + >>> pd.DataFrame({'col': [False]}).bool() # doctest: +SKIP False """