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 fillna not returning correct type #457

Closed
Dr-Irv opened this issue Oct 5, 2020 · 4 comments
Closed

pandas fillna not returning correct type #457

Dr-Irv opened this issue Oct 5, 2020 · 4 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 Oct 5, 2020

Environment data

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

Expected behaviour

No error

Actual behaviour

import pandas as pd
import numpy as np

df: pd.DataFrame = pd.DataFrame({"x": [1, np.nan, 3]})

ndf: pd.DataFrame = df.fillna(-1)

print(ndf)

reports

Expression of type "DataFrame | None" cannot be assigned to declared type "DataFrame"
  Type "DataFrame | None" cannot be assigned to type "DataFrame"
    Type "None" cannot be assigned to type "DataFrame"

Possible fix:

diff frame.pyi.ORIG frame.pyi
756c756
<         inplace: Literal[False]
---
>         inplace: Literal[False] = ...
@github-actions github-actions bot added the triage label Oct 5, 2020
@jakebailey jakebailey added the typestub Issue relating to our bundled type stubs label Oct 5, 2020
@github-actions github-actions bot removed the triage label Oct 5, 2020
@jakebailey jakebailey added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Oct 6, 2020
@jakebailey
Copy link
Member

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

@Dr-Irv
Copy link
Author

Dr-Irv commented Oct 9, 2020

@jakebailey I am running the 20.10.0 version now, and this is not fixed.

Here is what I did to that version to fix it:

diff frame.pyi.ORIG frame.pyi
653c653
<         inplace: Literal[True] = ...
---
>         inplace: Literal[True]
760c760
<         inplace: Literal[False]
---
>         inplace: Literal[False] = ...

@jakebailey jakebailey reopened this Oct 9, 2020
@jakebailey
Copy link
Member

Thanks, I'll fix that.

@jakebailey
Copy link
Member

This issue has been fixed in version 2020.10.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020101-14-october-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

3 participants