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

ENH: add NAType to PandasScalar type #835

Open
1 of 3 tasks
j-carson opened this issue Dec 19, 2023 · 3 comments
Open
1 of 3 tasks

ENH: add NAType to PandasScalar type #835

j-carson opened this issue Dec 19, 2023 · 3 comments

Comments

@j-carson
Copy link

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

I have a chunk of code where I create a series of Nulls -

pd.Series(
    index=myKeys,
    data=pd.NA,
    name="my_name"
)

I am having type-checking issues

error: No overload variant of "Series" matches argument types "Index[Any]", "NAType", "str"  [call-overload]

I believe it may be because pd.NA is not a valid scalar

_typing.py line 121

PandasScalar = Union["Period", "Timestamp", "Timedelta", "Interval"]

Feature Description

PandasScalar = Union["Period", "Timestamp", "Timedelta", "Interval", "NAType"]

Alternative Solutions

# type: ignore 

Or maybe I need to open an enhancement request to pandas-stubs library instead? please advise if so.

Additional Context

No response

@j-carson j-carson added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 19, 2023
@twoertwein twoertwein removed the Needs Triage Issue that has not been reviewed by a pandas team member label Dec 20, 2023
@twoertwein
Copy link
Member

twoertwein commented Dec 20, 2023

Based on your error, I assume you are using mypy, which makes me believe that the annotations that mypy are complaining about are from pandas-stubs and not pandas (mypy does not analyze annotations of non-py.typed libraries, pyright does). If that is the case, please open an issue at pandas-stubs. The same issue might also apply to pandas itself (I haven't checked that yet), so this issue could also stay open.

@twoertwein
Copy link
Member

This seems to be a pandas-stubs issue: pandas does not have any annotations for data
https://github.com/pandas-dev/pandas/blob/6a65c64e77d625f55f7b17e2a270014e5bd49e31/pandas/core/series.py#L383

@twoertwein twoertwein transferred this issue from pandas-dev/pandas Dec 20, 2023
@j-carson
Copy link
Author

j-carson commented Jan 7, 2024

@twoertwein Thank you for moving the issue for me -- I got busy with the holidays :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants