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
the diff overload doesn't seem exactly right for nullable types
To Reproduce
importpandasaspds: "pd.Series[bool]"=pd.Series([True, False], dtype='bool[pyarrow]')
reveal_type(s) # Type of "s" is "Series[bool]"reveal_type(s.diff()) # Type of "s.diff()" is "Series[type[object]]"
I think the issue is also that at runtime the traditional bool and the bool from pyarrow behaves differently.
A diff on the traditional bool outputs a series of object so the current type hint is matching static and dynamic while using pyarrow’s version of bool then you would end up with a series of bool[pyarrow].
So in your example when you force the series by defining the type as pd.Series[bool] you loose the information that it is a pyarrow bool and not the standard bool.
Right now we don’t have an overload for pyarrow bool, could be worth trying that out and see how the typehinting behaves.
Right now we don’t have an overload for pyarrow bool, could be worth trying that out and see how the typehinting behaves.
Creating the right different behaviors for using the nullable types versus non-nullable types would be a challenge. We have a similar issue if the dtype is Int64 versus int. Both are Series[int] in the stubs.
Describe the bug
the
diff
overload doesn't seem exactly right for nullable typesTo Reproduce
Please complete the following information:
pandas-stubs
2938805Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: