Skip to content

add typehint for None pct_change #51343

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

Conversation

FlynnOwen
Copy link
Contributor

I've added a typehint for None. It looks like supplying None as an argument to fill_method is tested for dataframes under pandas/tests/series/methods.

Let me know if another test should be written, e.g for dataframes.

Copy link
Member

@twoertwein twoertwein left a comment

Choose a reason for hiding this comment

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

Looks good to me!

The documentation already mentions None:

fill_method : {'backfill', 'bfill', 'pad', 'ffill', None}, default 'pad'
            How to handle NAs **before** computing percent changes.

but it might be nice to explain what None actually does (or reference to which function that parameter is forwarded to - presumably fillna?).

@MarcoGorelli
Copy link
Member

It looks like supplying None as an argument to fill_method is tested for dataframes under pandas/tests/series/methods.

you're right, thanks

agree that it would be good to document what passing None does

@mroeschke mroeschke added Docs Typing type annotations, mypy/pyright type checking labels Feb 13, 2023
@FlynnOwen
Copy link
Contributor Author

Would you like me to write docs on this branch / PR, or should that be done on another?

@MarcoGorelli MarcoGorelli added this to the 2.0 milestone Feb 13, 2023
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

another one is fine, might as well get this in - thanks @FlynnOwen !

@MarcoGorelli MarcoGorelli merged commit 081167d into pandas-dev:main Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: pct_change with fill_method=None isn't tested nor covered by type hints
4 participants