-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Reproducible Example
import pandas as pd
index_2000 = pd.date_range("2000-01-01", periods=2, freq="YS")
index_2001 = pd.date_range("2001-01-01", periods=1, freq="YS")
df_2000 = pd.Series(index=index_2000, data=[True, False], dtype="bool[pyarrow]")
df_2001 = pd.Series(index=index_2001, data=[True], dtype="bool[pyarrow]")
union = df_2000 & df_2001
print(union)
Issue Description
When using an operation like &
or |
between two boolean series with a different index and the pyarrow backend, I get the warning:
FutureWarning: Operation between non boolean Series with different indexes will no longer return a boolean result in a future version. Cast both Series to object type to maintain the prior behavior.
However my series are of the dtype bool[pyarrow]
, so I would expect this to be "boolean Series" and not see a warning.
I checked this on the main branch of pandas 3.0, and the result is indeed not a boolean series anymore, as I get
2000-01-01 <NA>
2001-01-01 False
Freq: YS-JAN, dtype: bool[pyarrow]
returned.
If the two Series are of type bool
(using numpy nullable backend), I don't get the warning and for pandas 3.0 I get
2000-01-01 False
2001-01-01 False
Freq: YS-JAN, dtype: bool
Expected Behavior
I would expect to get the same behaviour for Series of type bool[pyarrow]
as I get for type bool
.
So no warning about the input not being boolean series and for pandas 3.0 the same output as for numpy nullable boolean series.
Installed Versions
pandas : 2.3.2
numpy : 1.26.4
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 25.2
Cython : None
sphinx : 8.2.3
IPython : 9.3.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.4
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.6
lxml.etree : 5.4.0
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.5
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : 20.0.0
pyreadstat : None
pytest : 8.4.0
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.15.3
sqlalchemy : 2.0.41
tables : None
tabulate : 0.9.0
xarray : 2025.4.0
xlrd : None
xlsxwriter : 3.2.0
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None