Under mypy, pa.typing.Series does not support pd.DatetimeTZDtype as a valid type argument.
Bug occurs with and without pandera.mypy plugin
[x] I have checked that this issue has not already been reported.
[x] I have confirmed this bug exists on the latest version of pandera.
[ ] (optional) I have confirmed this bug exists on the master branch of pandera.
Code Sample, a copy-pastable example
from typing import Annotated
import pandas as pd
import pandera as pa
from pandera.typing import Series
class MySchema(pa.SchemaModel):
# both lines taken from the pandera documentation
a: Series[Annotated[pd.DatetimeTZDtype, "ns", "UTC"]]
b: Series[pd.DatetimeTZDtype] = pa.Field(dtype_kwargs={"unit": "ns", "tz": "UTC"})
Expected behavior
mypy should show no errors
Actual behaviour
mypy produces the following errors
test.py:8: error: Value of type variable "GenericDtype" of "Series" cannot be "DatetimeTZDtype"
test.py:9: error: Value of type variable "GenericDtype" of "Series" cannot be "DatetimeTZDtype"
Describe the bug
Under mypy,
pa.typing.Series
does not supportpd.DatetimeTZDtype
as a valid type argument.Bug occurs with and without
pandera.mypy
pluginCode Sample, a copy-pastable example
Expected behavior
mypy should show no errors
Actual behaviour
mypy produces the following errors
Versions