diff --git a/pandas/api/indexers/__init__.py b/pandas/api/indexers/__init__.py index 7dc824b691a01..78357f11dc3b7 100644 --- a/pandas/api/indexers/__init__.py +++ b/pandas/api/indexers/__init__.py @@ -3,7 +3,7 @@ """ from pandas.core.indexers import check_array_indexer -from pandas.core.window.indexers import ( +from pandas.core.indexers.objects import ( BaseIndexer, FixedForwardWindowIndexer, VariableOffsetWindowIndexer, diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 860d4f6a5dcc2..89fde53ac22b7 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -164,9 +164,9 @@ from pandas._libs.tslibs import BaseOffset from pandas.core.frame import DataFrame + from pandas.core.indexers.objects import BaseIndexer from pandas.core.resample import Resampler from pandas.core.series import Series - from pandas.core.window.indexers import BaseIndexer # goal is to be able to define the docs close to function, while still being # able to share diff --git a/pandas/core/indexers/__init__.py b/pandas/core/indexers/__init__.py new file mode 100644 index 0000000000000..1558b03162d22 --- /dev/null +++ b/pandas/core/indexers/__init__.py @@ -0,0 +1,31 @@ +from pandas.core.indexers.utils import ( + check_array_indexer, + check_key_length, + check_setitem_lengths, + deprecate_ndim_indexing, + is_empty_indexer, + is_exact_shape_match, + is_list_like_indexer, + is_scalar_indexer, + is_valid_positional_slice, + length_of_indexer, + maybe_convert_indices, + unpack_1tuple, + validate_indices, +) + +__all__ = [ + "is_valid_positional_slice", + "is_list_like_indexer", + "is_scalar_indexer", + "is_empty_indexer", + "check_setitem_lengths", + "validate_indices", + "maybe_convert_indices", + "is_exact_shape_match", + "length_of_indexer", + "deprecate_ndim_indexing", + "unpack_1tuple", + "check_key_length", + "check_array_indexer", +] diff --git a/pandas/core/window/indexers.py b/pandas/core/indexers/objects.py similarity index 100% rename from pandas/core/window/indexers.py rename to pandas/core/indexers/objects.py diff --git a/pandas/core/indexers.py b/pandas/core/indexers/utils.py similarity index 100% rename from pandas/core/indexers.py rename to pandas/core/indexers/utils.py diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index b8b473b0318aa..f0bba8ae9727f 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -26,6 +26,11 @@ from pandas.core.dtypes.missing import isna import pandas.core.common as common # noqa: PDF018 +from pandas.core.indexers.objects import ( + BaseIndexer, + ExponentialMovingWindowIndexer, + GroupbyIndexer, +) from pandas.core.util.numba_ import maybe_use_numba from pandas.core.window.common import zsqrt from pandas.core.window.doc import ( @@ -39,11 +44,6 @@ template_see_also, window_agg_numba_parameters, ) -from pandas.core.window.indexers import ( - BaseIndexer, - ExponentialMovingWindowIndexer, - GroupbyIndexer, -) from pandas.core.window.numba_ import ( generate_ewma_numba_table_func, generate_numba_ewma_func, diff --git a/pandas/core/window/expanding.py b/pandas/core/window/expanding.py index eedb6930bad66..36a6399df7dbc 100644 --- a/pandas/core/window/expanding.py +++ b/pandas/core/window/expanding.py @@ -18,6 +18,11 @@ from pandas.compat.numpy import function as nv from pandas.util._decorators import doc +from pandas.core.indexers.objects import ( + BaseIndexer, + ExpandingIndexer, + GroupbyIndexer, +) from pandas.core.window.doc import ( _shared_docs, args_compat, @@ -30,11 +35,6 @@ window_agg_numba_parameters, window_apply_parameters, ) -from pandas.core.window.indexers import ( - BaseIndexer, - ExpandingIndexer, - GroupbyIndexer, -) from pandas.core.window.rolling import ( BaseWindowGroupby, RollingAndExpandingMixin, diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index d4c0eb946505d..637b7c705d73c 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -55,6 +55,12 @@ SelectionMixin, ) import pandas.core.common as com +from pandas.core.indexers.objects import ( + BaseIndexer, + FixedWindowIndexer, + GroupbyIndexer, + VariableWindowIndexer, +) from pandas.core.indexes.api import ( DatetimeIndex, Index, @@ -85,12 +91,6 @@ window_agg_numba_parameters, window_apply_parameters, ) -from pandas.core.window.indexers import ( - BaseIndexer, - FixedWindowIndexer, - GroupbyIndexer, - VariableWindowIndexer, -) from pandas.core.window.numba_ import ( generate_manual_numpy_nan_agg_with_axis, generate_numba_apply_func, diff --git a/pandas/tests/window/test_base_indexer.py b/pandas/tests/window/test_base_indexer.py index 06867e80ee711..89c4b0cfdb4aa 100644 --- a/pandas/tests/window/test_base_indexer.py +++ b/pandas/tests/window/test_base_indexer.py @@ -11,7 +11,7 @@ BaseIndexer, FixedForwardWindowIndexer, ) -from pandas.core.window.indexers import ( +from pandas.core.indexers.objects import ( ExpandingIndexer, VariableOffsetWindowIndexer, )