File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 101
101
DataFrame ,
102
102
Series ,
103
103
)
104
+ from pandas .core .groupby .ops import BaseGrouper
104
105
from pandas .core .internals import Block # noqa:F401
105
106
106
107
@@ -538,18 +539,22 @@ class BaseWindowGroupby(BaseWindow):
538
539
Provide the groupby windowing facilities.
539
540
"""
540
541
542
+ _grouper : BaseGrouper
543
+ _as_index : bool
541
544
_attributes = ["_grouper" ]
542
545
543
546
def __init__ (
544
547
self ,
545
548
obj : FrameOrSeries ,
546
549
* args ,
547
- _grouper = None ,
548
- _as_index = True ,
550
+ _grouper : BaseGrouper ,
551
+ _as_index : bool = True ,
549
552
** kwargs ,
550
553
):
551
- if _grouper is None :
552
- raise ValueError ("Must pass a Grouper object." )
554
+ from pandas .core .groupby .ops import BaseGrouper
555
+
556
+ if not isinstance (_grouper , BaseGrouper ):
557
+ raise ValueError ("Must pass a BaseGrouper object." )
553
558
self ._grouper = _grouper
554
559
self ._as_index = _as_index
555
560
# GH 32262: It's convention to keep the grouping column in
@@ -659,7 +664,9 @@ def _apply_pairwise(
659
664
# When we evaluate the pairwise=True result, repeat the groupby
660
665
# labels by the number of columns in the original object
661
666
groupby_codes = self ._grouper .codes
662
- groupby_levels = self ._grouper .levels
667
+ # error: Incompatible types in assignment (expression has type
668
+ # "List[Index]", variable has type "List[Union[ndarray, Index]]")
669
+ groupby_levels = self ._grouper .levels # type: ignore[assignment]
663
670
664
671
group_indices = self ._grouper .indices .values ()
665
672
if group_indices :
You can’t perform that action at this time.
0 commit comments