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

pandas droplevel #735

Closed
gokturksm opened this issue Jun 17, 2020 · 3 comments
Closed

pandas droplevel #735

gokturksm opened this issue Jun 17, 2020 · 3 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@gokturksm
Copy link

gokturksm commented Jun 17, 2020

edit:
same for groupby and concat:
https://github.com/gokturksm/Fikirler/blob/master/so_6.py

Description
Pandas dataframe object unstacked, dropped NAs, and lastly dropped a level. Drop level returns a dataframe without the specified column level(s). This process has no problem but pyright says "Cannot access member "droplevel" for type "NoReturn" and "Member "droplevel" is unknownPyright (reportGeneralTypeIssues)". I don't exactly know why, so I'm opening this issue.

To Reproduce
https://github.com/gokturksm/Fikirler/blob/master/so_10.py#L27

Expected behavior
No problem would be produced by pyright.

Screenshots or Code
shared already

VS Code extension or command-line
extension

Additional context
disabled all other completion engines or python-related things.
"pyright.useLibraryCodeForTypes": true

@erictraut
Copy link
Collaborator

Thanks for reporting the issue.

Pyright is able to extract some type information from the implementation, so this case should still work. The problem is that when Pyright infers the return type of dropna, it is included a NoReturn type in the union. The NoReturn type should be stripped out of any union that includes it. Once it's removed, this error goes away.

This fix will be in the next published version of Pyright.

@erictraut erictraut added bug Something isn't working addressed in next version Issue is fixed and will appear in next published version labels Jun 18, 2020
@erictraut
Copy link
Collaborator

This is now fixed in version 1.1.44, which I just published.

heejaechang pushed a commit to heejaechang/pyright that referenced this issue Nov 3, 2021
@nyngwang
Copy link

nyngwang commented May 30, 2022

FYI: a similar problem seems to persist: the groupby doesn't show up with pyright. This happened on pandas 1.4.2.

update: The problem is resolved on pandas version 1.5.0 (installed via conda-forge):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants