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