diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 60364a87fd0..1c17075bbb7 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -97,6 +97,9 @@ Internal Changes By `Mathias Hauser `_. - Ensure tests are not skipped in the `py38-all-but-dask` test environment (:issue:`4509`). By `Mathias Hauser `_. +- Replace the internal use of ``pd.Index.__or__`` and ``pd.Index.__and__`` with ``pd.Index.union`` + and ``pd.Index.intersection`` as they will stop working as set operations in the future + (:issue:`4565`). By `Mathias Hauser `_. .. _whats-new.0.16.1: diff --git a/xarray/core/alignment.py b/xarray/core/alignment.py index b42a5b2c7a9..21bda8ef8d7 100644 --- a/xarray/core/alignment.py +++ b/xarray/core/alignment.py @@ -32,9 +32,9 @@ def _get_joiner(join): if join == "outer": - return functools.partial(functools.reduce, operator.or_) + return functools.partial(functools.reduce, pd.Index.union) elif join == "inner": - return functools.partial(functools.reduce, operator.and_) + return functools.partial(functools.reduce, pd.Index.intersection) elif join == "left": return operator.itemgetter(0) elif join == "right":