27
27
import pandas .core .common as com
28
28
from pandas .core .frame import DataFrame
29
29
from pandas .core .groupby .categorical import recode_for_groupby , recode_from_groupby
30
- from pandas .core .groupby . ops import BaseGrouper
30
+ from pandas .core .groupby import ops
31
31
from pandas .core .index import CategoricalIndex , Index , MultiIndex
32
32
from pandas .core .series import Series
33
33
@@ -392,7 +392,7 @@ def ngroups(self) -> int:
392
392
@cache_readonly
393
393
def indices (self ):
394
394
# we have a list of groupers
395
- if isinstance (self .grouper , BaseGrouper ):
395
+ if isinstance (self .grouper , ops . BaseGrouper ):
396
396
return self .grouper .indices
397
397
398
398
values = ensure_categorical (self .grouper )
@@ -419,7 +419,7 @@ def group_index(self) -> Index:
419
419
def _make_codes (self ) -> None :
420
420
if self ._codes is None or self ._group_index is None :
421
421
# we have a list of groupers
422
- if isinstance (self .grouper , BaseGrouper ):
422
+ if isinstance (self .grouper , ops . BaseGrouper ):
423
423
codes = self .grouper .codes_info
424
424
uniques = self .grouper .result_index
425
425
else :
@@ -442,7 +442,7 @@ def get_grouper(
442
442
observed : bool = False ,
443
443
mutated : bool = False ,
444
444
validate : bool = True ,
445
- ) -> Tuple [BaseGrouper , List [Hashable ], FrameOrSeries ]:
445
+ ) -> " Tuple[ops. BaseGrouper, List[Hashable], FrameOrSeries]" :
446
446
"""
447
447
Create and return a BaseGrouper, which is an internal
448
448
mapping of how to create the grouper indexers.
@@ -524,7 +524,7 @@ def get_grouper(
524
524
return grouper , [key .key ], obj
525
525
526
526
# already have a BaseGrouper, just return it
527
- elif isinstance (key , BaseGrouper ):
527
+ elif isinstance (key , ops . BaseGrouper ):
528
528
return key , [], obj
529
529
530
530
# In the future, a tuple key will always mean an actual key,
@@ -671,7 +671,7 @@ def is_in_obj(gpr) -> bool:
671
671
groupings .append (Grouping (Index ([], dtype = "int" ), np .array ([], dtype = np .intp )))
672
672
673
673
# create the internals grouper
674
- grouper = BaseGrouper (group_axis , groupings , sort = sort , mutated = mutated )
674
+ grouper = ops . BaseGrouper (group_axis , groupings , sort = sort , mutated = mutated )
675
675
return grouper , exclusions , obj
676
676
677
677
0 commit comments