Skip to content

BUG: incorrect type hint for subset in dropna #434

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
stevenlis opened this issue Nov 19, 2022 · 3 comments · Fixed by #498
Closed

BUG: incorrect type hint for subset in dropna #434

stevenlis opened this issue Nov 19, 2022 · 3 comments · Fixed by #498

Comments

@stevenlis
Copy link

Describe the bug

dropna() should accept any array like object.

To Reproduce
pylance in vscode

import pandas as pd
data = {'col1': [1, 3, 4], 'col2': [2, 3, 5], 'col2': [2, 4, 4]}
df = pd.DataFrame(data)

df.dropna(subset=df.columns.drop('col1'))

Please complete the following information:

  • OS: [MacOS]
  • OS Version [e.g. 13]
  • python version 3.9.12
  • version of type checker ?
  • version of installed pandas-stubs ?

Additional context
OP: pandas-dev/pandas#49702

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Nov 19, 2022

Have to change the subset argument for the 4 overloads in core/frame.pyi from list | None to ListLikeU | Scalar | None since you can pass Index, Series, np.ndarray, any Sequence, as well as individual scalars.

PR and tests welcome.

@shubhankarunhale
Copy link
Contributor

shubhankarunhale commented Jan 4, 2023

Hi @Dr-Irv , I was hoping to get started with this as a first contribution, can I work on this?
Also I don't understand what you meant by "LikeLikeU" in the suggested changes

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jan 4, 2023

Hi @Dr-Irv , I was hoping to get started with this as a first contribution, can I work on this? Also I don't understand what you meant by "LikeLikeU" in the suggested changes

Sorry that was a typo. Meant ListLikeU. Will fix in the comment above.

shubhankarunhale added a commit to shubhankarunhale/pandas-stubs that referenced this issue Jan 4, 2023
shubhankarunhale added a commit to shubhankarunhale/pandas-stubs that referenced this issue Jan 6, 2023
shubhankarunhale added a commit to shubhankarunhale/pandas-stubs that referenced this issue Jan 6, 2023
Dr-Irv pushed a commit that referenced this issue Jan 6, 2023
* added datatypes for dropna subset as per #434

* fixed failures

* Formatted file using poe style
twoertwein pushed a commit to twoertwein/pandas-stubs that referenced this issue Apr 1, 2023
* added datatypes for dropna subset as per pandas-dev#434

* fixed failures

* Formatted file using poe style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants