Skip to content

pandas.StringDtype's optional argument is reported by pyright as not optional #534

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

Closed
jasonboh opened this issue Feb 12, 2023 · 1 comment · Fixed by #535
Closed

pandas.StringDtype's optional argument is reported by pyright as not optional #534

jasonboh opened this issue Feb 12, 2023 · 1 comment · Fixed by #535
Labels
good first issue Strings String extension data type and string data

Comments

@jasonboh
Copy link

jasonboh commented Feb 12, 2023

Describe the bug
If I instantiate pd.StringDtype without args, pyright is complaining that it's missing an arg.

To Reproduce
import pandas as pd
d = pd.StringDtype() # pyright says missing the storage arg, but that arg is optional

Please complete the following information:
Windows
pyright
pandas-stubs-1.5.3.230203

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Feb 12, 2023

Thanks for the report.

Need to change

def __init__(self, storage: Literal["python", "pyarrow"] | None) -> None: ...
to be storage: Literal["python", "pyarrow"] | None = None with appropriate tests added to
def test_string_dtype() -> None:

@Dr-Irv Dr-Irv added good first issue Strings String extension data type and string data labels Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Strings String extension data type and string data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants