Skip to content

Pandera Series generic argument does not allow the typing.List etc. types #1555

@sam-goodwin

Description

@sam-goodwin

Code Sample, a copy-pastable example

import pandera as pa
import pandera.typing as pdt

class MySchema(pa.DataFrameModel):
    int32: pdt.Series[list[pdt.Int32]] = pa.Field()

Run mypy and get the following error:

error: Type argument "list[Int32]" of "Series" must be a subtype of "bool | int | str | float | ExtensionDtype | Bool | Date | Timestamp | Decimal | Timedelta | Category | Float | Float16 | Float32 | Float64 | Int | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | INT8 | INT16 | INT32 | INT64 | UINT8 | UINT16 | UINT32 | UINT64 | Object | String | STRING | Geometry"  [type-var]

Expected behavior

The type checking should not fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions