Skip to content

ENH: add NAType to PandasScalar type #835

@j-carson

Description

@j-carson

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions