Skip to content

TYP: Series.quantile #47304

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 3 commits into from
Jun 13, 2022
Merged

TYP: Series.quantile #47304

merged 3 commits into from
Jun 13, 2022

Conversation

twoertwein
Copy link
Member

No description provided.


def quantile(
self,
q: float | Sequence[float] | AnyArrayLike = 0.5,
Copy link
Member Author

Choose a reason for hiding this comment

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

Technically, I wouldn't need this overload to enable reportGeneralTypingIssues for pandas/core/describe.py - would only need float | Sequence[float]. In the absence of annotations, pyright assumes the default argument's type to be the annotation (in this case float).

return x

else:
f = mapper
Copy link
Member Author

Choose a reason for hiding this comment

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

pyright doesn't like re-declaring a function in addition to variables. For example, mypy will not allow this variable re-declaration

if flag:
    a: int = 1
else:
    a: int = 1  # error: Name "a" already defined on line 2  [no-redef]

pyright also applies this concept to function declarations (mypy does not).

@mroeschke mroeschke added this to the 1.5 milestone Jun 13, 2022
@mroeschke mroeschke added the Typing type annotations, mypy/pyright type checking label Jun 13, 2022
@mroeschke mroeschke merged commit 830130a into pandas-dev:main Jun 13, 2022
@mroeschke
Copy link
Member

Thanks @twoertwein

yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
* TYP: Series.quantile

* common.py
@twoertwein twoertwein deleted the quantile branch September 21, 2022 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants