2626from pandas .core .arrays import Categorical , ExtensionArray
2727import pandas .core .common as com
2828from pandas .core .frame import DataFrame
29+ from pandas .core .groupby import ops
2930from pandas .core .groupby .categorical import recode_for_groupby , recode_from_groupby
30- from pandas .core .groupby .ops import BaseGrouper
3131from pandas .core .index import CategoricalIndex , Index , MultiIndex
3232from pandas .core .series import Series
3333
@@ -390,7 +390,7 @@ def ngroups(self) -> int:
390390 @cache_readonly
391391 def indices (self ):
392392 # we have a list of groupers
393- if isinstance (self .grouper , BaseGrouper ):
393+ if isinstance (self .grouper , ops . BaseGrouper ):
394394 return self .grouper .indices
395395
396396 values = ensure_categorical (self .grouper )
@@ -417,7 +417,7 @@ def group_index(self) -> Index:
417417 def _make_codes (self ) -> None :
418418 if self ._codes is None or self ._group_index is None :
419419 # we have a list of groupers
420- if isinstance (self .grouper , BaseGrouper ):
420+ if isinstance (self .grouper , ops . BaseGrouper ):
421421 codes = self .grouper .codes_info
422422 uniques = self .grouper .result_index
423423 else :
@@ -440,7 +440,7 @@ def get_grouper(
440440 observed : bool = False ,
441441 mutated : bool = False ,
442442 validate : bool = True ,
443- ) -> Tuple [BaseGrouper , List [Hashable ], FrameOrSeries ]:
443+ ) -> " Tuple[ops. BaseGrouper, List[Hashable], FrameOrSeries]" :
444444 """
445445 Create and return a BaseGrouper, which is an internal
446446 mapping of how to create the grouper indexers.
@@ -522,7 +522,7 @@ def get_grouper(
522522 return grouper , [key .key ], obj
523523
524524 # already have a BaseGrouper, just return it
525- elif isinstance (key , BaseGrouper ):
525+ elif isinstance (key , ops . BaseGrouper ):
526526 return key , [], obj
527527
528528 # In the future, a tuple key will always mean an actual key,
@@ -669,7 +669,7 @@ def is_in_obj(gpr) -> bool:
669669 groupings .append (Grouping (Index ([], dtype = "int" ), np .array ([], dtype = np .intp )))
670670
671671 # create the internals grouper
672- grouper = BaseGrouper (group_axis , groupings , sort = sort , mutated = mutated )
672+ grouper = ops . BaseGrouper (group_axis , groupings , sort = sort , mutated = mutated )
673673 return grouper , exclusions , obj
674674
675675
0 commit comments