Skip to content
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

BUG: Series.clip should accept array-like for upper and lower #437

Closed
rhshadrach opened this issue Nov 23, 2022 · 1 comment · Fixed by #443
Closed

BUG: Series.clip should accept array-like for upper and lower #437

rhshadrach opened this issue Nov 23, 2022 · 1 comment · Fixed by #443
Labels

Comments

@rhshadrach
Copy link
Member

Describe the bug
Series.clip currently types upper and lower arguments as accepting Optional[float]. However they also accept array-like.

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.
ser = pd.Series([1, 2, 3])
ser.clip(upper=ser)

With mypy 0.991: error: Argument "upper" to "clip" of "Series has incompatible type "Series[Any]"; expected "Optional[float]"

@rhshadrach rhshadrach added Bug Series Series data structure labels Nov 23, 2022
@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Nov 23, 2022

Need to change lower and upper arguments here:

lower: float | None = ...,

And add tests.

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

Successfully merging a pull request may close this issue.

2 participants