From 06e747b847f83272abe7b9455b1330d4517b046f Mon Sep 17 00:00:00 2001 From: dkane01 Date: Fri, 19 Sep 2025 02:41:56 +0000 Subject: [PATCH] ENH: set __module__ on IndexSlice --- pandas/core/indexing.py | 6 +++++- pandas/tests/api/test_api.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 1ea06e5473805..98eb6034b6289 100644 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -28,7 +28,10 @@ LossySetitemError, ) from pandas.errors.cow import _chained_assignment_msg -from pandas.util._decorators import doc +from pandas.util._decorators import ( + doc, + set_module, +) from pandas.core.dtypes.cast import ( can_hold_element, @@ -101,6 +104,7 @@ # the public IndexSlicerMaker +@set_module("pandas") class _IndexSlice: """ Create an object to more easily perform multi-index slicing. diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 053c268dd8503..e6882144aa629 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -457,5 +457,6 @@ def test_set_module(): assert pd.to_timedelta.__module__ == "pandas" assert pd.to_numeric.__module__ == "pandas" assert pd.NamedAgg.__module__ == "pandas" + assert pd.IndexSlice.__module__ == "pandas" assert api.typing.SeriesGroupBy.__module__ == "pandas.api.typing" assert api.typing.DataFrameGroupBy.__module__ == "pandas.api.typing"