-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
aniaan
commented
Jan 9, 2021
- Ensure all linting tests pass, see here for how to run them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @BEANNAN for the PR. a couple of suggestions.
pandas/core/series.py
Outdated
def apply(self, func, convert_dtype=True, args=(), **kwds): | ||
def apply( | ||
self, func: AggFuncType, convert_dtype: bool = True, args: tuple = (), **kwds | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
): | |
) -> FrameOrSeriesUnion: |
pandas/core/series.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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
self, func: AggFuncType, convert_dtype: bool = True, args: tuple = (), **kwds | |
self, func: AggFuncType, convert_dtype: bool = True, args: Tuple[Any] = (), **kwds |
Corrected, please take a look |
see https://github.com/pandas-dev/pandas/runs/1673701200 for mypy failures |
CI has passed, please take a look |
can you merge master; your changes will now work in pandas/core/apply.py where thing were moved. |
Updated, but there was a slight problem with the CI that doesn't seem to be related to this commit |
yep, unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm