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 """