Skip to content

NA - Series type shows up as NAType as opposed to Series #1345

@MarcoGorelli

Description

@MarcoGorelli

Describe the bug

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
  2. Indicate which type checker you are using (mypy or pyright).
  3. Show the error message received from that type checker while checking your example.
from __future__ import annotations
import pandas as pd
from typing import reveal_type

s = pd.Series([1,2,3])

reveal_type(pd.NA - s)
print(type(pd.NA - s))

outputs

$ python t.py 
Runtime type is 'Series'
<class 'pandas.core.series.Series'>

$ pyright t.py 

/home/marcogorelli/pandas-stubs-dev/t.py
  /home/marcogorelli/pandas-stubs-dev/t.py:7:13 - information: Type of "pd.NA - s" is "NAType"
0 errors, 0 warnings, 1 information 

Note how the runtime type (Series) doesn't match the type-checked one NAType

Please complete the following information:

  • OS: [e.g. Windows, Linux, MacOS] linux (WSL2)
  • OS Version [e.g. 22]
  • python version 3.12.8
  • version of type checker pyright 1.1.403
  • version of installed pandas-stubs 82d1a65

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Missing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions