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 Series doesn't take a MultiIndex for the index argument #389

Closed
Dr-Irv opened this issue Sep 17, 2020 · 1 comment
Closed

pandas Series doesn't take a MultiIndex for the index argument #389

Dr-Irv opened this issue Sep 17, 2020 · 1 comment
Assignees
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

@Dr-Irv
Copy link

Dr-Irv commented Sep 17, 2020

Environment data

  • Language Server version: 2020.9.5
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda python 3.7.5

Expected behaviour

No error

Actual behaviour

mi2: pd.MultiIndex = pd.MultiIndex.from_product([[1, 2], [3, 4]], names=["a", "b"])
print(mi2)
s = pd.Series([1, 2, 3, 4], index=mi2)
print(s)

This gives error message:

Argument of type "MultiIndex" cannot be assigned to parameter "index" of type "str | int | Series[Unknown] | List[Unknown]" in function "__init__"
  Type "MultiIndex" cannot be assigned to type "str | int | Series[Unknown] | List[Unknown]"
    "MultiIndex" is incompatible with "str"
    "MultiIndex" is incompatible with "int"
    "MultiIndex" is incompatible with "Series[Unknown]"
    "MultiIndex" is incompatible with "List[Unknown]"

This change seems to fix it:

diff series.pyi.ORIG series.pyi
11a12
> from pandas.core.indexes.api import MultiIndex
56c57
<         index: Union[_str, int, Series, List] = ...,
---
>         index: Union[_str, int, Series, List, MultiIndex] = ...,
@jakebailey jakebailey added the bug Something isn't working label Sep 17, 2020
@github-actions github-actions bot removed the triage label Sep 17, 2020
@judej judej added typestub Issue relating to our bundled type stubs and removed bug Something isn't working labels Sep 21, 2020
@gramster gramster added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Sep 22, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.9.6, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202096-23-september-2020

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