- API reference
- pandas arrays, scalars, and data types
- pandas.array...
pandas.arrays.BooleanArray#
- classpandas.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 hoodrepresented by 2 numpy arrays: a boolean array with the data anda boolean array with the mask (True indicating missing).
BooleanArray implements Kleene logic (sometimes called three-valuelogic) for logical operations. SeeKleene logical operations for more.
To construct an BooleanArray from generic array-like input, use
pandas.array()
specifyingdtype="boolean"
(see examplesbelow).Warning
BooleanArray is considered experimental. The implementation andparts 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 (Trueindicates missing).
- copybool, default False
Whether to copy thevalues andmask arrays.
Attributes
None
Methods
None
- Returns:
- BooleanArray
Examples
Create an BooleanArray with
pandas.array()
:>>>pd.array([True,False,None],dtype="boolean")<BooleanArray>[True, False, <NA>]Length: 3, dtype: boolean