pandas.arrays.BooleanArray — pandas 3.0.0.dev0+2104.ge637b4290d documentation (original) (raw)
class pandas.arrays.BooleanArray(values, mask, copy=False)[source]#
Array of boolean (True/False) data with missing values.
This is a pandas Extension array for boolean data, under the hood represented by 2 numpy arrays: a boolean array with the data and a boolean array with the mask (True indicating missing).
BooleanArray implements Kleene logic (sometimes called three-value logic) for logical operations. See Kleene logical operations for more.
To construct an BooleanArray from generic array-like input, usepandas.array() specifying dtype="boolean"
(see examples below).
Warning
BooleanArray is considered experimental. The implementation and parts of the API may change without warning.
Parameters:
valuesnumpy.ndarray
A 1-d boolean-dtype array with the data.
masknumpy.ndarray
A 1-d boolean-dtype array indicating missing values (True indicates missing).
copybool, default False
Whether to copy the values and mask arrays.
Attributes
Methods
Returns:
BooleanArray
See also
Create an array from data with the appropriate dtype.
BooleanDtype
Extension dtype for boolean data.
Series
One-dimensional ndarray with axis labels (including time series).
DataFrame
Two-dimensional, size-mutable, potentially heterogeneous tabular data.
Examples
Create an BooleanArray with pandas.array():
pd.array([True, False, None], dtype="boolean") [True, False, ] Length: 3, dtype: boolean