diff --git a/pandas/core/generic.py b/pandas/core/generic.py index bbaa6d3faeb05..b0063ca659a38 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -1526,7 +1526,8 @@ def bool(self) -> bool_t: .. deprecated:: 2.1.0 - bool is deprecated and will be removed in future version of pandas + bool is deprecated and will be removed in future version of pandas. + For ``Series`` use ``pandas.Series.item``. 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 @@ -1556,6 +1557,14 @@ def bool(self) -> bool_t: True >>> pd.DataFrame({'col': [False]}).bool() # doctest: +SKIP False + + This is an alternative method and will only work + for single element objects with a boolean value: + + >>> pd.Series([True]).item() # doctest: +SKIP + True + >>> pd.Series([False]).item() # doctest: +SKIP + False """ warnings.warn(