Mypy
is correctly telling me that the following is missing the generic arg for pd.Series
def foo(x : pd.Series) -> None:
pass
When I add the arg like so
from typing import Any
def foo(x : pd.Series[Any]) -> None:
pass
and I try to run my code using Python 3.10.10
and using python myfile.py
to run it I get the following
def foo(x: pd.Series[Any]) -> None:
TypeError: 'type' object is not subscriptable
I'm also using pandas-stubs==1.5.3.230203
for pandas
type stubs.
Related question here indicates this type hinting should be possible. I've also found code examples here