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

Arguments for pd.concat missing Series #390

Closed
Dr-Irv opened this issue Sep 18, 2020 · 2 comments
Closed

Arguments for pd.concat missing Series #390

Dr-Irv opened this issue Sep 18, 2020 · 2 comments
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 18, 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

s1 = pd.Series([1, 2, 3])
s2 = pd.Series([4, 5, 6])
dc = pd.concat([s1, s2], axis=1)
print(dc)

reports

Argument of type "List[Series[Unknown]]" cannot be assigned to parameter "objs" of type "Iterable[DataFrame] | Mapping[Hashable | None, DataFrame]" in function "concat"
  Type "List[Series[Unknown]]" cannot be assigned to type "Iterable[DataFrame] | Mapping[Hashable | None, DataFrame]"
    "List[Series[Unknown]]" is incompatible with "Mapping[Hashable | None, DataFrame]"
      TypeVar "_T_co" is covariant
        "Series[Unknown]" is incompatible with "DataFrame"

Fix is:

diff concat.pyi.ORIG concat.pyi.IRV
1a2
> from pandas import Series as Series
4c5
< def concat(objs: Union[Iterable[DataFrame], Mapping[Optional[Hashable], DataFrame]], axis=..., join: str=..., ignore_index: bool=..., keys=..., levels=..., names=..., verify_integrity: bool=..., sort: bool=..., copy: bool=...) -> DataFrame: ...
---
> def concat(objs: Union[Iterable[DataFrame], Iterable[Series], Mapping[Optional[Hashable], DataFrame]], axis=..., join: str=..., ignore_index: bool=..., keys=..., levels=..., names=..., verify_integrity: bool=..., sort: bool=..., copy: bool=...) -> DataFrame: ...
@jakebailey jakebailey added the bug Something isn't working label Sep 18, 2020
@github-actions github-actions bot removed the triage label Sep 18, 2020
@Dr-Irv
Copy link
Author

Dr-Irv commented Sep 18, 2020

It's actually missing combinations of Series and DataFrame, so this seems to be the right fix:

diff core/reshape/concat.pyi.ORIG core/reshape/concat.pyi
1a2
> from pandas import Series as Series
4c5
< def concat(objs: Union[Iterable[DataFrame], Mapping[Optional[Hashable], DataFrame]], axis=..., join: str=..., ignore_index: bool=..., keys=..., levels=..., names=..., verify_integrity: bool=..., sort: bool=..., copy: bool=...) -> DataFrame: ...
---
> def concat(objs: Union[Iterable[Union[DataFrame, Series]], Mapping[Optional[Hashable], DataFrame]], axis=..., join: str=..., ignore_index: bool=..., keys=..., levels=..., names=..., verify_integrity: bool=..., sort: bool=..., copy: bool=...) -> DataFrame: ...

@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