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
importpandasaspds: "pd.Series[str]"=pd.Series(['a', 'b'])
reveal_type(s) # information: Type of "s" is "Series[str]"reveal_type(s.str.upper()) # information: Type of "s.str.upper()" is "Series[Unknown]"
The reason I'm reporting this is that the source code uses a TypeVar, so the intention might have been that the type be preserved?
The issue here is less about the T but I think is closer to the str property which does not preserve the type of s.
If you try to highlight the type of s.str you realize that it has lost the information about whether it is a Series[str] or anything else.
I can’t remember how to properly type hint properties but that may be an idea.
I think that the declaration of str in Series should add an argument to StringMethods related to the subtype of Index or Series, i.e., include S1 in that signature so that the bound value of S1 gets passed down. At least that's my hunch!
The reason I'm reporting this is that the source code uses a TypeVar, so the intention might have been that the type be preserved?
pandas-stubs/pandas-stubs/core/strings.pyi
Line 180 in d410f2e
The text was updated successfully, but these errors were encountered: