From 8e0d1de612bbcad09b7bbe1cfa656c5949bbc0e8 Mon Sep 17 00:00:00 2001 From: Jonas Hoersch Date: Mon, 20 May 2024 08:13:54 +0200 Subject: [PATCH 1/2] fix(selectors): Make isin selector return a Series --- src/pandas_indexing/selectors.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pandas_indexing/selectors.py b/src/pandas_indexing/selectors.py index a5b127f..e65f4d2 100644 --- a/src/pandas_indexing/selectors.py +++ b/src/pandas_indexing/selectors.py @@ -135,7 +135,9 @@ def apply_filter(value, level): return value(index.get_level_values(level)) return index.isin(np.atleast_1d(value), level=level) - return reduce(and_, (apply_filter(v, k) for k, v in filters.items())) + return Series( + reduce(and_, (apply_filter(v, k) for k, v in filters.items())), index + ) def isin( From e83958d2c98c73981e6469700fc1e9e8fe29fba8 Mon Sep 17 00:00:00 2001 From: Jonas Hoersch Date: Mon, 20 May 2024 08:20:48 +0200 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7337961..117eb85 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,8 @@ Changelog ========= +* Fix :func:`~selectors.isin` to always return a series (instead of a numpy array) + v0.5.0 (2024-04-09) ------------------------------------------------------------ * **BREAKING**: Change :func:`~core.extractlevel` to drop split levels by default and