Skip to content

BUG: Inconsistency of BooleanArray.__and__ with pd.NA and [pd.NA] #63095

@cmp0xff

Description

@cmp0xff

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

from typing import reveal_type
import pandas as pd

b = pd.array([True, False])

reveal_type(b & pd.NA)  # works
reveal_type(b & [pd.NA, False])  # TypeError: boolean value of NA is ambiguous

Issue Description

BooleanArray.__and__(pd.NA) works, but BooleanArray.__and__([pd.NA]) fails. This was found in pandas-dev/pandas-stubs#1480

Expected Behavior

BooleanArray.__and__([pd.NA]) can just give pd.NA.

Installed Versions

INSTALLED VERSIONS

commit : f60bf95
python : 3.11.13
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.26200
machine : AMD64
processor : AMD64 Family 25 Model 116 Stepping 1, AuthenticAMD
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : Czech_Czechia.1252

pandas : 3.0.0.dev0+2338.gf60bf958da.dirty
numpy : 2.2.6
dateutil : 2.9.0.post0
pip : 25.2
Cython : 3.1.3
sphinx : 8.2.3
IPython : 9.4.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.5
bottleneck : 1.5.0
fastparquet : 2024.11.0
fsspec : 2025.7.0
html5lib : 1.1
hypothesis : 6.138.3
gcsfs : 2025.7.0
jinja2 : 3.1.6
lxml.etree : 6.0.1
matplotlib : 3.10.5
numba : 0.61.2
numexpr : 2.10.2
odfpy : None
openpyxl : 3.1.5
psycopg2 : 2.9.10
pymysql : 1.4.6
pyarrow : 19.0.1
pyiceberg : 0.9.1
pyreadstat : 1.3.1
pytest : 8.4.1
python-calamine : None
pytz : 2025.2
pyxlsb : 1.0.10
s3fs : 2025.7.0
scipy : 1.16.1
sqlalchemy : 2.0.43
tables : 3.10.2
tabulate : 0.9.0
xarray : 2025.8.0
xlrd : 2.0.1
xlsxwriter : 3.2.5
zstandard : 0.23.0
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions