Skip to content

var-annotated error for Series and Index after upgrading to 2.0.3+ #826

Closed
@amgcc

Description

@amgcc

Describe the bug
Upgrading from 2.0.1 to 2.1.1 and now I get errors about Series and Index that aren't helpful. It should not be necessary to duplicate type hints on a local variable.

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
    idx0 = pd.Index()
    idx1: pd.Index = pd.Index()
    sr0 = pd.Series()
    sr1: pd.Series = pd.Series()
  1. Indicate which type checker you are using (mypy or pyright).
    mypy

  2. Show the error message received from that type checker while checking your example.

error: Need type annotation for "idx0"  [var-annotated]
error: Need type annotation for "sr0"  [var-annotated]

Please complete the following information:

  • OS: [e.g. Windows, Linux, MacOS]
  • Linux
  • OS Version [e.g. 22]
  • python version
  • 3.8
  • version of type checker
  • 1.7.1
  • version of installed pandas-stubs
  • 2.1.1 and 2.0.3 failing, 2.0.1 no error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions