Skip to content

Conversation

@Dr-Irv
Copy link
Contributor

@Dr-Irv Dr-Irv commented May 21, 2021

With pylance 2021.5.3, the following code

import pandas as pd

df = pd.DataFrame({"x": [1.0, 2.0, 3.0], "y": [4.0, 5, 6]})

sx: pd.Series = df["x"]

ss = sx.astype(str)

print(ss)

reports on the astype line:

Argument of type "Type[str]" cannot be assigned to parameter "dtype" of type "Dtype@__getitem__ | str" in function "astype"
  Type "Type[str]" cannot be assigned to type "Dtype@__getitem__ | str"
    Type "Type[str]" cannot be assigned to type "Dtype@__getitem__"
    "Type[type]" is incompatible with "_str"

This PR fixes that issue.

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jakebailey jakebailey merged commit 718938f into microsoft:main May 21, 2021
@Dr-Irv Dr-Irv deleted the astypetype branch February 18, 2022 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants