Skip to content

TYP fixup overload in reset_index #40798

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 2 commits into from
Apr 7, 2021

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Apr 6, 2021

If we have t.py:

import pandas as pd

inplace: bool

reveal_type(pd.DataFrame([1,2,3]).reset_index(0, inplace=True, col_fill='a'))

then on master, the last line would be revelead as Revealed type is 'Union[pandas.core.frame.DataFrame, None]'. With the current changes, it will be revealed as Revealed type is 'None'

This function takes arguments level, drop, inplace - if drop isn't passed, then inplace needs to be passed by keyword, but level can be passed positionally

@MarcoGorelli MarcoGorelli added the Typing type annotations, mypy/pyright type checking label Apr 6, 2021
@simonjayhawkins simonjayhawkins added this to the 1.3 milestone Apr 7, 2021
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

Thanks @MarcoGorelli lgtm.

(If you want, no pressure, feel free to pick up #40202 if that would benefit adding overloads. I doubt I will circle back to it for a while)

@MarcoGorelli
Copy link
Member Author

Thanks Simon - merging following your approval then (also, as this is really small, and serves as an example to others doing overload issues)

@MarcoGorelli MarcoGorelli merged commit 9f668bd into pandas-dev:master Apr 7, 2021
@MarcoGorelli MarcoGorelli deleted the fixup-reset-index branch April 7, 2021 16:40
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
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