xorbits.pandas.DataFrame.bool#

DataFrame.bool() bool#

Return the bool of a single element Series or DataFrame.

2.1.0(pandas) 版后已移除: 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).

返回

The value in the Series or DataFrame.

返回类型

bool

参见

Series.astype

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

DataFrame.astype

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

numpy.bool_

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

实际案例

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

>>> pd.Series([True]).bool()  
True
>>> pd.Series([False]).bool()  
False
>>> pd.DataFrame({'col': [True]}).bool()  
True
>>> pd.DataFrame({'col': [False]}).bool()  
False

警告

This method has not been implemented yet. Xorbits will try to execute it with pandas.

This docstring was copied from pandas.core.frame.DataFrame.