pandas 1.4.2

ReturnsBackRef
bool(self)

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).

Returns

bool

The value in the Series or DataFrame.

Return the bool of a single element Series or DataFrame.

See Also

DataFrame.astype

Change the data type of a DataFrame, including to boolean.

Series.astype

Change the data type of a Series, including to boolean.

numpy.bool_

NumPy boolean data type, used by pandas for boolean values.

Examples

The method will only work for single element objects with a boolean value:

This example is valid syntax, but we were not able to check execution
>>> pd.Series([True]).bool()
True
This example is valid syntax, but we were not able to check execution
>>> pd.Series([False]).bool()
False
This example is valid syntax, but we were not able to check execution
>>> pd.DataFrame({'col': [True]}).bool()
True
This example is valid syntax, but we were not able to check execution
>>> pd.DataFrame({'col': [False]}).bool()
False
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.strings.accessor.StringMethods.contains

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/generic.py#1534
type: <class 'function'>
Commit: