Skip to content

CLN/depr: NDFrame.bool #52802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
"""

Expand Down