Skip to content

TYP: series apply method adds type hints #39058

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 7 commits into from
Jan 11, 2021
4 changes: 3 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3979,7 +3979,9 @@ def transform(
) -> FrameOrSeriesUnion:
return transform(self, func, axis, *args, **kwargs)

def apply(self, func, convert_dtype=True, args=(), **kwds):
def apply(
self, func: AggFuncType, convert_dtype: bool = True, args: tuple = (), **kwds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Tuple from typing and add type parameters where possible

Suggested change
self, func: AggFuncType, convert_dtype: bool = True, args: tuple = (), **kwds
self, func: AggFuncType, convert_dtype: bool = True, args: Tuple[Any] = (), **kwds

):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
):
) -> FrameOrSeriesUnion:

"""
Invoke function on values of Series.

Expand Down