pandas.arrays.BooleanArray

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, use pandas.array() specifying dtype="boolean" (see examples below).

New in version 1.0.0.

Warning

BooleanArray is considered experimental. The implementation and parts of the API may change without warning.

Parameters
values:numpy.ndarray

A 1-d boolean-dtype array with the data.

mask:numpy.ndarray

A 1-d boolean-dtype array indicating missing values (True indicates missing).

copy:bool, default False

Whether to copy the values and mask arrays.

Returns
BooleanArray

Examples

Create an BooleanArray with pandas.array():

>>> pd.array([True, False, None], dtype="boolean")
<BooleanArray>
[True, False, <NA>]
Length: 3, dtype: boolean

Attributes

None

Methods

None

© 2008–2021, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.3.4/reference/api/pandas.arrays.BooleanArray.html