Skip to content

TYP: obj in aggregation.py #37532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
from pandas.core.arrays.base import ExtensionArray # noqa: F401
from pandas.core.frame import DataFrame
from pandas.core.generic import NDFrame # noqa: F401
from pandas.core.groupby.generic import DataFrameGroupBy, SeriesGroupBy
from pandas.core.indexes.base import Index
from pandas.core.resample import Resampler
from pandas.core.series import Series
from pandas.core.window.rolling import BaseWindow

from pandas.io.formats.format import EngFormatter

Expand Down Expand Up @@ -115,6 +118,14 @@
List[AggFuncTypeBase],
AggFuncTypeDict,
]
AggObjType = Union[
"Series",
"DataFrame",
"SeriesGroupBy",
"DataFrameGroupBy",
"BaseWindow",
"Resampler",
]


# for arbitrary kwargs passed during reading/writing files
Expand Down
7 changes: 4 additions & 3 deletions pandas/core/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
AggFuncType,
AggFuncTypeBase,
AggFuncTypeDict,
AggObjType,
Axis,
FrameOrSeries,
FrameOrSeriesUnion,
Expand Down Expand Up @@ -530,7 +531,7 @@ def transform_str_or_callable(


def aggregate(
obj,
obj: AggObjType,
arg: AggFuncType,
*args,
**kwargs,
Expand Down Expand Up @@ -580,7 +581,7 @@ def aggregate(


def agg_list_like(
obj,
obj: AggObjType,
arg: List[AggFuncTypeBase],
_axis: int,
) -> FrameOrSeriesUnion:
Expand Down Expand Up @@ -672,7 +673,7 @@ def agg_list_like(


def agg_dict_like(
obj,
obj: AggObjType,
arg: AggFuncTypeDict,
_axis: int,
) -> FrameOrSeriesUnion:
Expand Down