Skip to content

DataFrame.pct_change typing for None missing #992

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

Closed
loicdiridollou opened this issue Sep 3, 2024 · 0 comments · Fixed by #993
Closed

DataFrame.pct_change typing for None missing #992

loicdiridollou opened this issue Sep 3, 2024 · 0 comments · Fixed by #993

Comments

@loicdiridollou
Copy link
Member

Describe the bug
A clear and concise description of what the bug is.
For the pd.DataFrame.pct_change the documentation allows the None method but the typing only supports str.
This results in an error from pyright to be raised.

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
  2. Indicate which type checker you are using (mypy or pyright).
  3. Show the error message received from that type checker while checking your example.
df = pd.DataFrame({"x": [1, 2, 2, 3, 3], "y": [10, 20, 30, 40, 50]})
df.pct_change(fill_method=None)

This example will yield the error:

error: Argument "fill_method" to "pct_change" of "DataFrame" has incompatible type "None"; expected "str"  [arg-type]

While the documentation allows for None:
Screenshot 2024-09-03 at 6 04 46 PM

Please complete the following information:

  • OS: MacOs
  • OS Version Sonoma 14
  • python version 3.12.4
  • version of type checker 1.1.378
  • version of installed pandas-stubs v2.2.2.240807

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant