Skip to content

nested type annotation raises TypeError #1245

Closed
@Ranfir

Description

@Ranfir

This works:

from __future__ import annotations
import pandas as pd
lst: list[pd.Series[int]] = []

As does this:

from __future__ import annotations
import pandas as pd
list["pd.Series[int]"]()

But not this:

from __future__ import annotations
import pandas as pd
list[pd.Series[int]]()

TypeError: type 'Series' is not subscriptable

For what it's worth, pyarrow-stubs suffers from the same issue.

  • OS: Debian GNU/Linux 11 (bullseye)
  • python 3.13.3
  • pandas-stubs 2.2.3.250308

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