You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Type annotation for pd.Series uses Sequence[Any] instead of Iterable[Any], but the documentation states that argument can be an iterable.
To Reproduce
Provide a minimal runnable pandas example that is not properly checked by the stubs.
importpandasaspdpd.Series({}.keys())
Indicate which type checker you are using (mypy or pyright). mypy
Show the error message received from that type checker while checking your example.
While the documentation does say "Iterable", not all iterables are accepted. For example, a set is not accepted. The keys() method acts like a set from a typing perspective. So while passing keys() to Series() works, it's not a best practice.
There is an open issue on the pandas repo where I brought up whether we want to accept dictionary views: pandas-dev/pandas#55425 (comment)
I will leave this open for now, but I don't think we are going to support this.
Describe the bug
Type annotation for
pd.Series
usesSequence[Any]
instead ofIterable[Any]
, but the documentation states that argument can be an iterable.To Reproduce
pandas
example that is not properly checked by the stubs.mypy
orpyright
).mypy
Please complete the following information:
pandas-stubs
: 2.1.1.230928Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: