On 1.5.x:
df = pd.DataFrame({'a': [1, 1, 2], 'b': [3, 4, 5]}).set_index(['a', 'b'])
print(df.index.isin([]))
# [False False False]
On 2.0.x:
TypeError: Cannot infer number of levels from empty list
Seems like an Index consisting of False is the right answer here.
Comment From: rhshadrach
commit 02d988ca8f5be9ffe8435b7f37c4dd8d43ccd108
Author: Patrick Hoefler
Date: Tue Sep 20 00:58:34 2022 +0200
PERF: Improve performance for MultiIndex.isin (#48622)
* PERF: Improve performance for MultiIndex.isin
* PERF: Improve performance for MultiIndex.isin
* Fix gh ref
asv_bench/benchmarks/multiindex_object.py | 32 +++++++++++++++++++++++++++++++
doc/source/whatsnew/v1.6.0.rst | 1 +
pandas/core/indexes/multi.py | 3 +--
3 files changed, 34 insertions(+), 2 deletions(-)
cc @phofl