Skip to content

Commit 015a223

Browse files
committed
change NDFrame to FrameOrSeries
1 parent 34bbbd7 commit 015a223

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: pandas/core/groupby/grouper.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from pandas.core.arrays import Categorical, ExtensionArray
2727
import pandas.core.common as com
2828
from pandas.core.frame import DataFrame
29-
from pandas.core.generic import NDFrame
3029
from pandas.core.groupby.categorical import recode_for_groupby, recode_from_groupby
3130
from pandas.core.groupby.ops import BaseGrouper
3231
from pandas.core.index import CategoricalIndex, Index, MultiIndex
@@ -430,15 +429,15 @@ def groups(self) -> dict:
430429

431430

432431
def get_grouper(
433-
obj: NDFrame,
432+
obj: FrameOrSeries,
434433
key=None,
435434
axis: int = 0,
436435
level=None,
437436
sort=True,
438437
observed=False,
439438
mutated=False,
440439
validate=True,
441-
) -> Tuple[BaseGrouper, List[Hashable], NDFrame]:
440+
) -> Tuple[BaseGrouper, List[Hashable], FrameOrSeries]:
442441
"""
443442
Create and return a BaseGrouper, which is an internal
444443
mapping of how to create the grouper indexers.
@@ -571,7 +570,8 @@ def get_grouper(
571570
all_in_columns_index = all(
572571
g in obj.columns or g in obj.index.names for g in keys
573572
)
574-
else: # Series
573+
else:
574+
assert isinstance(obj, Series)
575575
all_in_columns_index = all(g in obj.index.names for g in keys)
576576

577577
if not all_in_columns_index:

0 commit comments

Comments
 (0)