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: loc indexer not return the correct type of object #660

Closed
RuixiangLiu01 opened this issue Nov 30, 2020 · 5 comments
Closed

pandas: loc indexer not return the correct type of object #660

RuixiangLiu01 opened this issue Nov 30, 2020 · 5 comments
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version typestub Issue relating to our bundled type stubs

Comments

@RuixiangLiu01
Copy link

Hi, developer. I meet a problem when using 'loc' to select some columns, it seems 'loc' doesn't return the a DataFrame for me
image
image

any advise would be appreciated, thanks

@RuixiangLiu01
Copy link
Author

RuixiangLiu01 commented Nov 30, 2020

update:
I checked the stub files
image
I think my code should be inferred as a DataFrame not a Seires accroding to the code in stub file

@judej judej added typestub Issue relating to our bundled type stubs waiting for user response Requires more information from user labels Nov 30, 2020
@github-actions github-actions bot removed the triage label Nov 30, 2020
@judej
Copy link
Contributor

judej commented Nov 30, 2020

@RuixiangLiu01, could you please add a code snippet for this so that we could repro?

@RuixiangLiu01
Copy link
Author

@RuixiangLiu01, could you please add a code snippet for this so that we could repro?

Thanks for reply. Here is a simple example:
df = pd.DataFrame({'A': [1, 2, 3, 4], 'B': [2, 3, 4, 5]}) df1 = df.loc[:,'A']
image
image

I am not sure is it helpful for u

@jakebailey jakebailey added needs investigation Could be an issue - needs investigation and removed waiting for user response Requires more information from user labels Dec 3, 2020
@gramster
Copy link
Member

This is a non-trivial fix; right now things only work as well as they do because of a bug :-( There's a bunch of complexity around this kind of indexing that I need to think through.

@gramster gramster changed the title pandas loc indexer not return the correct type of object pandas: loc indexer not return the correct type of object Dec 18, 2020
@jakebailey jakebailey added fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels May 5, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.5.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202150-5-may-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version typestub Issue relating to our bundled type stubs
Projects
None yet
Development

No branches or pull requests

4 participants